You are here

protected function Rss::_setTitle in Zircon Profile 8.0

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

Set feed title

Parameters

DOMDocument $dom:

DOMElement $root:

Return value

void

Throws

Writer\Exception\InvalidArgumentException

1 call to Rss::_setTitle()
Rss::render in vendor/zendframework/zend-feed/src/Writer/Renderer/Feed/Rss.php
Render RSS feed

File

vendor/zendframework/zend-feed/src/Writer/Renderer/Feed/Rss.php, line 121

Class

Rss

Namespace

Zend\Feed\Writer\Renderer\Feed

Code

protected function _setTitle(DOMDocument $dom, DOMElement $root) {
  if (!$this
    ->getDataContainer()
    ->getTitle()) {
    $message = 'RSS 2.0 feed elements MUST contain exactly one' . ' title element but a title has not been set';
    $exception = new Writer\Exception\InvalidArgumentException($message);
    if (!$this->ignoreExceptions) {
      throw $exception;
    }
    else {
      $this->exceptions[] = $exception;
      return;
    }
  }
  $title = $dom
    ->createElement('title');
  $root
    ->appendChild($title);
  $text = $dom
    ->createTextNode($this
    ->getDataContainer()
    ->getTitle());
  $title
    ->appendChild($text);
}