You are here

public function Rss::getId in Zircon Profile 8

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

Get the feed ID

Return value

string|null

Overrides FeedInterface::getId

File

vendor/zendframework/zend-feed/src/Reader/Feed/Rss.php, line 338

Class

Rss

Namespace

Zend\Feed\Reader\Feed

Code

public function getId() {
  if (array_key_exists('id', $this->data)) {
    return $this->data['id'];
  }
  $id = null;
  if ($this
    ->getType() !== Reader\Reader::TYPE_RSS_10 && $this
    ->getType() !== Reader\Reader::TYPE_RSS_090) {
    $id = $this->xpath
      ->evaluate('string(/rss/channel/guid)');
  }
  if (!$id && $this
    ->getExtension('DublinCore') !== null) {
    $id = $this
      ->getExtension('DublinCore')
      ->getId();
  }
  if (empty($id)) {
    $id = $this
      ->getExtension('Atom')
      ->getId();
  }
  if (!$id) {
    if ($this
      ->getLink()) {
      $id = $this
        ->getLink();
    }
    elseif ($this
      ->getTitle()) {
      $id = $this
        ->getTitle();
    }
    else {
      $id = null;
    }
  }
  $this->data['id'] = $id;
  return $this->data['id'];
}