code: public function toNode(DOMDocument $document = null)
      {
          if (null === $document) {
              $document = new DOMDocument();
          }
  
          $node = $document->createElement('TariffInfo');
  
          // Required
          $node->appendChild($document->createElement('TariffCode', $this->getTariffCode()));
  
          // Optional
          if ($this->getDetailId() !== null) {
              $node->appendChild($document->createElement('DetailId', $this->getDetailId()));
          }
          if ($this->getSecondaryTariffCode() !== null) {
              $node->appendChild($document->createElement('SecondaryTariffCode', $this->getSecondaryTariffCode()));
          }
          if ($this->getSecondaryDetailId() !== null) {
              $node->appendChild($document->createElement('SecondaryDetailId', $this->getSecondaryDetailId()));
          }
  
          return $node;
      }
docs: @param null|DOMDocument $document
  
  @return DOMElement