You are here

public function Entry::getEnclosure in Zircon Profile 8.0

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

Get the entry enclosure

Return value

string

File

vendor/zendframework/zend-feed/src/Reader/Extension/Atom/Entry.php, line 239

Class

Entry

Namespace

Zend\Feed\Reader\Extension\Atom

Code

public function getEnclosure() {
  if (array_key_exists('enclosure', $this->data)) {
    return $this->data['enclosure'];
  }
  $enclosure = null;
  $nodeList = $this
    ->getXpath()
    ->query($this
    ->getXpathPrefix() . '/atom:link[@rel="enclosure"]');
  if ($nodeList->length > 0) {
    $enclosure = new stdClass();
    $enclosure->url = $nodeList
      ->item(0)
      ->getAttribute('href');
    $enclosure->length = $nodeList
      ->item(0)
      ->getAttribute('length');
    $enclosure->type = $nodeList
      ->item(0)
      ->getAttribute('type');
  }
  $this->data['enclosure'] = $enclosure;
  return $this->data['enclosure'];
}