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

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

        // Required
        if ($this->getTariffInfo() !== null) {
            $node->appendChild($this->getTariffInfo()->toNode($document));
        }
        if ($this->getUnitPrice() !== null) {
            $node->appendChild($this->getUnitPrice()->toNode($document));
        }
        if ($this->getQuantity() !== null) {
            $node->appendChild($this->getQuantity()->toNode($document));
        }

        // Optional
        if ($this->getProductName() !== null) {
            $node->appendChild($document->createElement('ProductName', $this->getProductName()));
        }
        if ($this->getProductDescription() !== null) {
            $node->appendChild($document->createElement('ProductDescription', $this->getProductDescription()));
        }
        if ($this->getProductCountryCodeOfOrigin() !== null) {
            $node->appendChild(
                $document->createElement(
                    'ProductCountryCodeOfOrigin',
                    $this->getProductCountryCodeOfOrigin()
                )
            );
        }
        if ($this->getWeight() instanceof Weight) {
            $node->appendChild($this->getWeight()->toNode($document));
        }
        if ($this->getTariffCodeAlert() !== null) {
            $node->appendChild($document->createElement('TariffCodeAlert', $this->getTariffCodeAlert()));
        }

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

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

        // Required
        if ($this->getTariffInfo() !== null) {
            $node->appendChild($this->getTariffInfo()->toNode($document));
        }
        if ($this->getUnitPrice() !== null) {
            $node->appendChild($this->getUnitPrice()->toNode($document));
        }
        if ($this->getQuantity() !== null) {
            $node->appendChild($this->getQuantity()->toNode($document));
        }

        // Optional
        if ($this->getProductName() !== null) {
            $node->appendChild($document->createElement('ProductName', $this->getProductName()));
        }
        if ($this->getProductDescription() !== null) {
            $node->appendChild($document->createElement('ProductDescription', $this->getProductDescription()));
        }
        if ($this->getProductCountryCodeOfOrigin() !== null) {
            $node->appendChild(
                $document->createElement(
                    'ProductCountryCodeOfOrigin',
                    $this->getProductCountryCodeOfOrigin()
                )
            );
        }
        if ($this->getWeight() instanceof Weight) {
            $node->appendChild($this->getWeight()->toNode($document));
        }
        if ($this->getTariffCodeAlert() !== null) {
            $node->appendChild($document->createElement('TariffCodeAlert', $this->getTariffCodeAlert()));
        }

        return $node;
    }
@param null|DOMDocument $document

@return DOMElement