You are here

class AtomSource in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/zendframework/zend-feed/src/Writer/Renderer/Feed/AtomSource.php \Zend\Feed\Writer\Renderer\Feed\AtomSource

Hierarchy

  • class \Zend\Feed\Writer\Renderer\Feed\AbstractAtom extends \Renderer\AbstractRenderer
    • class \Zend\Feed\Writer\Renderer\Feed\AtomSource implements \Renderer\RendererInterface

Expanded class hierarchy of AtomSource

File

vendor/zendframework/zend-feed/src/Writer/Renderer/Feed/AtomSource.php, line 19

Namespace

Zend\Feed\Writer\Renderer\Feed
View source
class AtomSource extends AbstractAtom implements Renderer\RendererInterface {

  /**
   * Constructor
   *
   * @param  Writer\Source $container
   */
  public function __construct(Writer\Source $container) {
    parent::__construct($container);
  }

  /**
   * Render Atom Feed Metadata (Source element)
   *
   * @return \Zend\Feed\Writer\Renderer\Feed\Atom
   */
  public function render() {
    if (!$this->container
      ->getEncoding()) {
      $this->container
        ->setEncoding('UTF-8');
    }
    $this->dom = new DOMDocument('1.0', $this->container
      ->getEncoding());
    $this->dom->formatOutput = true;
    $root = $this->dom
      ->createElement('source');
    $this
      ->setRootElement($root);
    $this->dom
      ->appendChild($root);
    $this
      ->_setLanguage($this->dom, $root);
    $this
      ->_setBaseUrl($this->dom, $root);
    $this
      ->_setTitle($this->dom, $root);
    $this
      ->_setDescription($this->dom, $root);
    $this
      ->_setDateCreated($this->dom, $root);
    $this
      ->_setDateModified($this->dom, $root);
    $this
      ->_setGenerator($this->dom, $root);
    $this
      ->_setLink($this->dom, $root);
    $this
      ->_setFeedLinks($this->dom, $root);
    $this
      ->_setId($this->dom, $root);
    $this
      ->_setAuthors($this->dom, $root);
    $this
      ->_setCopyright($this->dom, $root);
    $this
      ->_setCategories($this->dom, $root);
    foreach ($this->extensions as $ext) {
      $ext
        ->setType($this
        ->getType());
      $ext
        ->setRootElement($this
        ->getRootElement());
      $ext
        ->setDOMDocument($this
        ->getDOMDocument(), $root);
      $ext
        ->render();
    }
    return $this;
  }

  /**
   * Set feed generator string
   *
   * @param  DOMDocument $dom
   * @param  DOMElement $root
   * @return void
   */
  protected function _setGenerator(DOMDocument $dom, DOMElement $root) {
    if (!$this
      ->getDataContainer()
      ->getGenerator()) {
      return;
    }
    $gdata = $this
      ->getDataContainer()
      ->getGenerator();
    $generator = $dom
      ->createElement('generator');
    $root
      ->appendChild($generator);
    $text = $dom
      ->createTextNode($gdata['name']);
    $generator
      ->appendChild($text);
    if (array_key_exists('uri', $gdata)) {
      $generator
        ->setAttribute('uri', $gdata['uri']);
    }
    if (array_key_exists('version', $gdata)) {
      $generator
        ->setAttribute('version', $gdata['version']);
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AbstractAtom::_setAuthors protected function Set feed authors
AbstractAtom::_setBaseUrl protected function Set base URL to feed links
AbstractAtom::_setCategories protected function Set feed categories
AbstractAtom::_setCopyright protected function Set feed copyright
AbstractAtom::_setDateCreated protected function Set date feed was created
AbstractAtom::_setDateModified protected function Set date feed was last modified
AbstractAtom::_setDescription protected function Set feed description
AbstractAtom::_setFeedLinks protected function Set feed links
AbstractAtom::_setHubs protected function Set hubs to which this feed pushes
AbstractAtom::_setId protected function Set feed identifier
AbstractAtom::_setImage protected function Set feed level logo (image)
AbstractAtom::_setLanguage protected function Set feed language
AbstractAtom::_setLink protected function Set link to feed
AbstractAtom::_setTitle protected function Set feed title
AtomSource::render public function Render Atom Feed Metadata (Source element)
AtomSource::_setGenerator protected function Set feed generator string Overrides AbstractAtom::_setGenerator
AtomSource::__construct public function Constructor Overrides AbstractAtom::__construct