Atom.php in Zircon Profile 8.0
File
vendor/zendframework/zend-feed/src/Reader/Entry/Atom.php
View source
<?php
namespace Zend\Feed\Reader\Entry;
use DOMElement;
use DOMXPath;
use Zend\Feed\Reader;
class Atom extends AbstractEntry implements EntryInterface {
protected $xpathQuery = '';
public function __construct(DOMElement $entry, $entryKey, $type = null) {
parent::__construct($entry, $entryKey, $type);
$this->xpathQuery = '//atom:entry[' . ($this->entryKey + 1) . ']';
$manager = Reader\Reader::getExtensionManager();
$extensions = [
'Atom\\Entry',
'Thread\\Entry',
'DublinCore\\Entry',
];
foreach ($extensions as $name) {
$extension = $manager
->get($name);
$extension
->setEntryElement($entry);
$extension
->setEntryKey($entryKey);
$extension
->setType($type);
$this->extensions[$name] = $extension;
}
}
public function getAuthor($index = 0) {
$authors = $this
->getAuthors();
if (isset($authors[$index])) {
return $authors[$index];
}
return;
}
public function getAuthors() {
if (array_key_exists('authors', $this->data)) {
return $this->data['authors'];
}
$people = $this
->getExtension('Atom')
->getAuthors();
$this->data['authors'] = $people;
return $this->data['authors'];
}
public function getContent() {
if (array_key_exists('content', $this->data)) {
return $this->data['content'];
}
$content = $this
->getExtension('Atom')
->getContent();
$this->data['content'] = $content;
return $this->data['content'];
}
public function getDateCreated() {
if (array_key_exists('datecreated', $this->data)) {
return $this->data['datecreated'];
}
$dateCreated = $this
->getExtension('Atom')
->getDateCreated();
$this->data['datecreated'] = $dateCreated;
return $this->data['datecreated'];
}
public function getDateModified() {
if (array_key_exists('datemodified', $this->data)) {
return $this->data['datemodified'];
}
$dateModified = $this
->getExtension('Atom')
->getDateModified();
$this->data['datemodified'] = $dateModified;
return $this->data['datemodified'];
}
public function getDescription() {
if (array_key_exists('description', $this->data)) {
return $this->data['description'];
}
$description = $this
->getExtension('Atom')
->getDescription();
$this->data['description'] = $description;
return $this->data['description'];
}
public function getEnclosure() {
if (array_key_exists('enclosure', $this->data)) {
return $this->data['enclosure'];
}
$enclosure = $this
->getExtension('Atom')
->getEnclosure();
$this->data['enclosure'] = $enclosure;
return $this->data['enclosure'];
}
public function getId() {
if (array_key_exists('id', $this->data)) {
return $this->data['id'];
}
$id = $this
->getExtension('Atom')
->getId();
$this->data['id'] = $id;
return $this->data['id'];
}
public function getLink($index = 0) {
if (!array_key_exists('links', $this->data)) {
$this
->getLinks();
}
if (isset($this->data['links'][$index])) {
return $this->data['links'][$index];
}
return;
}
public function getLinks() {
if (array_key_exists('links', $this->data)) {
return $this->data['links'];
}
$links = $this
->getExtension('Atom')
->getLinks();
$this->data['links'] = $links;
return $this->data['links'];
}
public function getPermalink() {
return $this
->getLink(0);
}
public function getTitle() {
if (array_key_exists('title', $this->data)) {
return $this->data['title'];
}
$title = $this
->getExtension('Atom')
->getTitle();
$this->data['title'] = $title;
return $this->data['title'];
}
public function getCommentCount() {
if (array_key_exists('commentcount', $this->data)) {
return $this->data['commentcount'];
}
$commentcount = $this
->getExtension('Thread')
->getCommentCount();
if (!$commentcount) {
$commentcount = $this
->getExtension('Atom')
->getCommentCount();
}
$this->data['commentcount'] = $commentcount;
return $this->data['commentcount'];
}
public function getCommentLink() {
if (array_key_exists('commentlink', $this->data)) {
return $this->data['commentlink'];
}
$commentlink = $this
->getExtension('Atom')
->getCommentLink();
$this->data['commentlink'] = $commentlink;
return $this->data['commentlink'];
}
public function getCommentFeedLink() {
if (array_key_exists('commentfeedlink', $this->data)) {
return $this->data['commentfeedlink'];
}
$commentfeedlink = $this
->getExtension('Atom')
->getCommentFeedLink();
$this->data['commentfeedlink'] = $commentfeedlink;
return $this->data['commentfeedlink'];
}
public function getCategories() {
if (array_key_exists('categories', $this->data)) {
return $this->data['categories'];
}
$categoryCollection = $this
->getExtension('Atom')
->getCategories();
if (count($categoryCollection) == 0) {
$categoryCollection = $this
->getExtension('DublinCore')
->getCategories();
}
$this->data['categories'] = $categoryCollection;
return $this->data['categories'];
}
public function getSource() {
if (array_key_exists('source', $this->data)) {
return $this->data['source'];
}
$source = $this
->getExtension('Atom')
->getSource();
$this->data['source'] = $source;
return $this->data['source'];
}
public function setXpath(DOMXPath $xpath) {
parent::setXpath($xpath);
foreach ($this->extensions as $extension) {
$extension
->setXpath($this->xpath);
}
}
}