code: public function toXML( XMLWriter $XMLWriter )
      {
          if ($this->id) {
              $XMLWriter->writeElement( 'UsuarioID', $this->id );
          } else {
              throw new RequiredFieldException( 'Field ID of the Customer object is required' );
          }
  
          if ($this->type) {
              $XMLWriter->writeElement( 'TipoUsuario', $this->type );
          } else {
              throw new RequiredFieldException( 'Field Type of the Customer object is required' );
          }
  
          if ($this->legalDocument1) {
              $XMLWriter->writeElement( 'DocumentoLegal1', $this->legalDocument1 );
          } else {
              throw new RequiredFieldException( 'Field LegalDocument1 of the Customer object is required' );
          }
  
          if ($this->legalDocument2) {
              $XMLWriter->writeElement( 'DocumentoLegal2', $this->legalDocument2 );
          }
  
          if ($this->name) {
              $XMLWriter->writeElement( 'Nome', $this->name );
          } else {
              throw new RequiredFieldException( 'Field name of the Customer object is required' );
          }
  
          if ($this->email) {
              $XMLWriter->writeElement( 'Email', $this->email );
          }
  
          if ($this->sex) {
              $XMLWriter->writeElement( 'Sexo', $this->sex );
          }
  
          if ($this->birthDate) {
              $XMLWriter->writeElement( 'Nascimento', $this->birthDate->format( self::DATE_TIME_FORMAT ) );
          }
  
          if ($this->address) {
              $this->address->toXML( $XMLWriter );
          } else {
              throw new RequiredFieldException( 'Field Address of the Customer object is required' );
          }
  
          if (count( $this->phones ) > 0) {
              $XMLWriter->startElement( 'Telefones' );
  
              foreach ($this->phones as $phone) {
                  $phone->toXML( $XMLWriter );
              }
  
              $XMLWriter->endElement();
          } else {
              throw new RequiredFieldException( 'Field Phones of the Customer object is required' );
          }
      }
docs: @param  \XMLWriter $XMLWriter
  
  @throws \RodrigoPedra\ClearSaleID\Exception\RequiredFieldException