You are here

protected function Atom::_setDateModified in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/zendframework/zend-feed/src/Writer/Renderer/Entry/Atom.php \Zend\Feed\Writer\Renderer\Entry\Atom::_setDateModified()

Set date entry was modified

Parameters

DOMDocument $dom:

DOMElement $root:

Return value

void

Throws

Writer\Exception\InvalidArgumentException

1 call to Atom::_setDateModified()
Atom::render in vendor/zendframework/zend-feed/src/Writer/Renderer/Entry/Atom.php
Render atom entry

File

vendor/zendframework/zend-feed/src/Writer/Renderer/Entry/Atom.php, line 123

Class

Atom

Namespace

Zend\Feed\Writer\Renderer\Entry

Code

protected function _setDateModified(DOMDocument $dom, DOMElement $root) {
  if (!$this
    ->getDataContainer()
    ->getDateModified()) {
    $message = 'Atom 1.0 entry elements MUST contain exactly one' . ' atom:updated element but a modification date has not been set';
    $exception = new Writer\Exception\InvalidArgumentException($message);
    if (!$this->ignoreExceptions) {
      throw $exception;
    }
    else {
      $this->exceptions[] = $exception;
      return;
    }
  }
  $updated = $dom
    ->createElement('updated');
  $root
    ->appendChild($updated);
  $text = $dom
    ->createTextNode($this
    ->getDataContainer()
    ->getDateModified()
    ->format(DateTime::ATOM));
  $updated
    ->appendChild($text);
}