src/Entity/ShipmentServiceOptions.php
public function toNode(DOMDocument $document = null)
    {
        if (null === $document) {
            $document = new DOMDocument();
        }

        $node = $document->createElement('ShipmentServiceOptions');

        if (isset($this->DirectDeliveryOnlyIndicator)) {
            $node->appendChild($document->createElement('DirectDeliveryOnlyIndicator'));
        }

        if (isset($this->DeliverToAddresseeOnlyIndicator)) {
            $node->appendChild($document->createElement('DeliverToAddresseeOnlyIndicator'));
        }

        if (isset($this->SaturdayPickup)) {
            $node->appendChild($document->createElement('SaturdayPickup'));
        }

        if (isset($this->SaturdayDelivery)) {
            $node->appendChild($document->createElement('SaturdayDelivery'));
        }

        if ($this->getCOD()) {
            $node->appendChild($this->getCOD()->toNode($document));
        }

        if ($this->getAccessPointCOD()) {
            $node->appendChild($this->getAccessPointCOD()->toNode($document));
        }

        if (isset($this->internationalForms)) {
            $node->appendChild($this->internationalForms->toNode($document));
        }

        if (isset($this->deliveryConfirmation)) {
            $node->appendChild($this->deliveryConfirmation->toNode($document));
        }

        if (isset($this->importControlIndicator)) {
            $node->appendChild($document->createElement('ImportControlIndicator'));
        }

        if (isset($this->labelMethod)) {
            $node->appendChild($this->labelMethod->toNode($document));
        }

        if (isset($this->labelDelivery)) {
            $labelDeliveryNode = $node->appendChild($document->createElement('LabelDelivery'));
            $emailMessageNode = $labelDeliveryNode->appendChild($document->createElement('EMailMessage'));
            $labelDelivery = $this->getLabelDelivery();
            foreach ($labelDelivery as $key => $value) {
                if ($key == 'LabelLinkIndicator') {
                    $labelDeliveryNode->appendChild($document->createElement($key, $value));
                } elseif ($key == 'SubjectCode') {
                    $SubjectNode = $emailMessageNode->appendChild($document->createElement('Subject'));
                    $SubjectNode->appendChild($document->createElement($key, $value));
                } else {
                    $emailMessageNode->appendChild($document->createElement($key, $value));
                }
            }
        }

        if (!empty($this->notifications)) {
            foreach ($this->notifications as $notification) {
                $node->appendChild($notification->toNode($document));
            }
        }

        return $node;
    }
public function toNode(DOMDocument $document = null)
    {
        if (null === $document) {
            $document = new DOMDocument();
        }

        $node = $document->createElement('ShipmentServiceOptions');

        if (isset($this->DirectDeliveryOnlyIndicator)) {
            $node->appendChild($document->createElement('DirectDeliveryOnlyIndicator'));
        }

        if (isset($this->DeliverToAddresseeOnlyIndicator)) {
            $node->appendChild($document->createElement('DeliverToAddresseeOnlyIndicator'));
        }

        if (isset($this->SaturdayPickup)) {
            $node->appendChild($document->createElement('SaturdayPickup'));
        }

        if (isset($this->SaturdayDelivery)) {
            $node->appendChild($document->createElement('SaturdayDelivery'));
        }

        if ($this->getCOD()) {
            $node->appendChild($this->getCOD()->toNode($document));
        }

        if ($this->getAccessPointCOD()) {
            $node->appendChild($this->getAccessPointCOD()->toNode($document));
        }

        if (isset($this->internationalForms)) {
            $node->appendChild($this->internationalForms->toNode($document));
        }

        if (isset($this->deliveryConfirmation)) {
            $node->appendChild($this->deliveryConfirmation->toNode($document));
        }

        if (isset($this->importControlIndicator)) {
            $node->appendChild($document->createElement('ImportControlIndicator'));
        }

        if (isset($this->labelMethod)) {
            $node->appendChild($this->labelMethod->toNode($document));
        }

        if (isset($this->labelDelivery)) {
            $labelDeliveryNode = $node->appendChild($document->createElement('LabelDelivery'));
            $emailMessageNode = $labelDeliveryNode->appendChild($document->createElement('EMailMessage'));
            $labelDelivery = $this->getLabelDelivery();
            foreach ($labelDelivery as $key => $value) {
                if ($key == 'LabelLinkIndicator') {
                    $labelDeliveryNode->appendChild($document->createElement($key, $value));
                } elseif ($key == 'SubjectCode') {
                    $SubjectNode = $emailMessageNode->appendChild($document->createElement('Subject'));
                    $SubjectNode->appendChild($document->createElement($key, $value));
                } else {
                    $emailMessageNode->appendChild($document->createElement($key, $value));
                }
            }
        }

        if (!empty($this->notifications)) {
            foreach ($this->notifications as $notification) {
                $node->appendChild($notification->toNode($document));
            }
        }

        return $node;
    }
public function toNode ( DOMDocument $ document = null ) { if ( null === $ document ) { $ document = new DOMDocument ( ) ; } $ node = $ document -> createElement ( 'ShipmentServiceOptions' ) ; if ( isset ( $ this -> DirectDeliveryOnlyIndicator ) ) { $ node -> appendChild ( $ document -> createElement ( 'DirectDeliveryOnlyIndicator' ) ) ; } if ( isset ( $ this -> DeliverToAddresseeOnlyIndicator ) ) { $ node -> appendChild ( $ document -> createElement ( 'DeliverToAddresseeOnlyIndicator' ) ) ; } if ( isset ( $ this -> SaturdayPickup ) ) { $ node -> appendChild ( $ document -> createElement ( 'SaturdayPickup' ) ) ; } if ( isset ( $ this -> SaturdayDelivery ) ) { $ node -> appendChild ( $ document -> createElement ( 'SaturdayDelivery' ) ) ; } if ( $ this -> getCOD ( ) ) { $ node -> appendChild ( $ this -> getCOD ( ) -> toNode ( $ document ) ) ; } if ( $ this -> getAccessPointCOD ( ) ) { $ node -> appendChild ( $ this -> getAccessPointCOD ( ) -> toNode ( $ document ) ) ; } if ( isset ( $ this -> internationalForms ) ) { $ node -> appendChild ( $ this -> internationalForms -> toNode ( $ document ) ) ; } if ( isset ( $ this -> deliveryConfirmation ) ) { $ node -> appendChild ( $ this -> deliveryConfirmation -> toNode ( $ document ) ) ; } if ( isset ( $ this -> importControlIndicator ) ) { $ node -> appendChild ( $ document -> createElement ( 'ImportControlIndicator' ) ) ; } if ( isset ( $ this -> labelMethod ) ) { $ node -> appendChild ( $ this -> labelMethod -> toNode ( $ document ) ) ; } if ( isset ( $ this -> labelDelivery ) ) { $ labelDeliveryNode = $ node -> appendChild ( $ document -> createElement ( 'LabelDelivery' ) ) ; $ emailMessageNode = $ labelDeliveryNode -> appendChild ( $ document -> createElement ( 'EMailMessage' ) ) ; $ labelDelivery = $ this -> getLabelDelivery ( ) ; foreach ( $ labelDelivery as $ key => $ value ) { if ( $ key == 'LabelLinkIndicator' ) { $ labelDeliveryNode -> appendChild ( $ document -> createElement ( $ key , $ value ) ) ; } elseif ( $ key == 'SubjectCode' ) { $ SubjectNode = $ emailMessageNode -> appendChild ( $ document -> createElement ( 'Subject' ) ) ; $ SubjectNode -> appendChild ( $ document -> createElement ( $ key , $ value ) ) ; } else { $ emailMessageNode -> appendChild ( $ document -> createElement ( $ key , $ value ) ) ; } } } if ( ! empty ( $ this -> notifications ) ) { foreach ( $ this -> notifications as $ notification ) { $ node -> appendChild ( $ notification -> toNode ( $ document ) ) ; } } return $ node ; }
@param null|DOMDocument $document

@return DOMElement
@param null|DOMDocument $document