protected function AbstractAtom::_setId in Zircon Profile 8
Same name in this branch
- 8 vendor/zendframework/zend-feed/src/Writer/Renderer/Feed/AbstractAtom.php \Zend\Feed\Writer\Renderer\Feed\AbstractAtom::_setId()
- 8 vendor/zendframework/zend-feed/src/Writer/Renderer/Feed/Atom/AbstractAtom.php \Zend\Feed\Writer\Renderer\Feed\Atom\AbstractAtom::_setId()
Same name and namespace in other branches
- 8.0 vendor/zendframework/zend-feed/src/Writer/Renderer/Feed/AbstractAtom.php \Zend\Feed\Writer\Renderer\Feed\AbstractAtom::_setId()
Set feed identifier
Parameters
DOMDocument $dom:
DOMElement $root:
Return value
void
Throws
Writer\Exception\InvalidArgumentException
2 calls to AbstractAtom::_setId()
- 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 255
Class
Namespace
Zend\Feed\Writer\Renderer\FeedCode
protected function _setId(DOMDocument $dom, DOMElement $root) {
if (!$this
->getDataContainer()
->getId() && !$this
->getDataContainer()
->getLink()) {
$message = 'Atom 1.0 feed elements MUST contain exactly one ' . 'atom:id element, or as an alternative, we can use the same ' . 'value as atom:link however neither a suitable link nor an ' . 'id have been set';
$exception = new Writer\Exception\InvalidArgumentException($message);
if (!$this->ignoreExceptions) {
throw $exception;
}
else {
$this->exceptions[] = $exception;
return;
}
}
if (!$this
->getDataContainer()
->getId()) {
$this
->getDataContainer()
->setId($this
->getDataContainer()
->getLink());
}
$id = $dom
->createElement('id');
$root
->appendChild($id);
$text = $dom
->createTextNode($this
->getDataContainer()
->getId());
$id
->appendChild($text);
}