You are here

public function Rss::getEnclosure in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/zendframework/zend-feed/src/Reader/Entry/Rss.php \Zend\Feed\Reader\Entry\Rss::getEnclosure()

Get the entry enclosure

Return value

string

Overrides EntryInterface::getEnclosure

File

vendor/zendframework/zend-feed/src/Reader/Entry/Rss.php, line 280

Class

Rss

Namespace

Zend\Feed\Reader\Entry

Code

public function getEnclosure() {
  if (array_key_exists('enclosure', $this->data)) {
    return $this->data['enclosure'];
  }
  $enclosure = null;
  if ($this
    ->getType() == Reader\Reader::TYPE_RSS_20) {
    $nodeList = $this->xpath
      ->query($this->xpathQueryRss . '/enclosure');
    if ($nodeList->length > 0) {
      $enclosure = new \stdClass();
      $enclosure->url = $nodeList
        ->item(0)
        ->getAttribute('url');
      $enclosure->length = $nodeList
        ->item(0)
        ->getAttribute('length');
      $enclosure->type = $nodeList
        ->item(0)
        ->getAttribute('type');
    }
  }
  if (!$enclosure) {
    $enclosure = $this
      ->getExtension('Atom')
      ->getEnclosure();
  }
  $this->data['enclosure'] = $enclosure;
  return $this->data['enclosure'];
}