public function toXML( XMLWriter $XMLWriter )
    {
        $XMLWriter->startElement( 'Telefone' );

        if (!is_null( $this->type )) {
            $XMLWriter->writeElement( 'Tipo', $this->type );
        } else {
            throw new RequiredFieldException( 'Field Type of the Phone object is required' );
        }

        if ($this->ddi) {
            $XMLWriter->writeElement( 'DDI', $this->ddi );
        }

        if ($this->ddd) {
            $XMLWriter->writeElement( 'DDD', $this->ddd );
        } else {
            throw new RequiredFieldException( 'Field DDD of the Phone object is required' );
        }

        if ($this->number) {
            $XMLWriter->writeElement( 'Numero', $this->number );
        } else {
            throw new RequiredFieldException( 'Field Number of the Phone object is required' );
        }

        if ($this->extension) {
            $XMLWriter->writeElement( 'Ramal', $this->extension );
        }

        $XMLWriter->endElement();
    }
public function toXML( XMLWriter $XMLWriter )
    {
        $XMLWriter->startElement( 'Telefone' );

        if (!is_null( $this->type )) {
            $XMLWriter->writeElement( 'Tipo', $this->type );
        } else {
            throw new RequiredFieldException( 'Field Type of the Phone object is required' );
        }

        if ($this->ddi) {
            $XMLWriter->writeElement( 'DDI', $this->ddi );
        }

        if ($this->ddd) {
            $XMLWriter->writeElement( 'DDD', $this->ddd );
        } else {
            throw new RequiredFieldException( 'Field DDD of the Phone object is required' );
        }

        if ($this->number) {
            $XMLWriter->writeElement( 'Numero', $this->number );
        } else {
            throw new RequiredFieldException( 'Field Number of the Phone object is required' );
        }

        if ($this->extension) {
            $XMLWriter->writeElement( 'Ramal', $this->extension );
        }

        $XMLWriter->endElement();
    }
@param  \XMLWriter $XMLWriter

@throws \RodrigoPedra\ClearSaleID\Exception\RequiredFieldException