You are here

public function Entry::getSource 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::getSource()
  2. 8.0 vendor/zendframework/zend-feed/src/Reader/Extension/Atom/Entry.php \Zend\Feed\Reader\Extension\Atom\Entry::getSource()
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::getSource()

Get source feed metadata from the entry

Return value

Reader\Feed\Atom\Source|null

File

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

Class

Entry

Namespace

Zend\Feed\Reader\Extension\Atom

Code

public function getSource() {
  if (array_key_exists('source', $this->data)) {
    return $this->data['source'];
  }
  $source = null;

  // TODO: Investigate why _getAtomType() fails here. Is it even needed?
  if ($this
    ->getType() == Reader\Reader::TYPE_ATOM_10) {
    $list = $this
      ->getXpath()
      ->query($this
      ->getXpathPrefix() . '/atom:source[1]');
    if ($list->length) {
      $element = $list
        ->item(0);
      $source = new Reader\Feed\Atom\Source($element, $this
        ->getXpathPrefix());
    }
  }
  $this->data['source'] = $source;
  return $this->data['source'];
}