You are here

protected function AbstractAtom::_setDateModified in Zircon Profile 8

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

Set date feed was last modified

Parameters

DOMDocument $dom:

DOMElement $root:

Return value

void

Throws

Writer\Exception\InvalidArgumentException

2 calls to AbstractAtom::_setDateModified()
Atom::render in vendor/zendframework/zend-feed/src/Writer/Renderer/Feed/Atom.php
Render Atom feed
AtomSource::render in vendor/zendframework/zend-feed/src/Writer/Renderer/Feed/AtomSource.php
Render Atom Feed Metadata (Source element)

File

vendor/zendframework/zend-feed/src/Writer/Renderer/Feed/AbstractAtom.php, line 104

Class

AbstractAtom

Namespace

Zend\Feed\Writer\Renderer\Feed

Code

protected function _setDateModified(DOMDocument $dom, DOMElement $root) {
  if (!$this
    ->getDataContainer()
    ->getDateModified()) {
    $message = 'Atom 1.0 feed 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);
}