public function Rss::getCategories in Zircon Profile 8
Same name in this branch
- 8 vendor/zendframework/zend-feed/src/Reader/Entry/Rss.php \Zend\Feed\Reader\Entry\Rss::getCategories()
- 8 vendor/zendframework/zend-feed/src/Reader/Feed/Rss.php \Zend\Feed\Reader\Feed\Rss::getCategories()
Same name and namespace in other branches
- 8.0 vendor/zendframework/zend-feed/src/Reader/Entry/Rss.php \Zend\Feed\Reader\Entry\Rss::getCategories()
Get all categories
Return value
Reader\Collection\Category
Overrides EntryInterface::getCategories
File
- vendor/
zendframework/ zend-feed/ src/ Reader/ Entry/ Rss.php, line 407
Class
Namespace
Zend\Feed\Reader\EntryCode
public function getCategories() {
if (array_key_exists('categories', $this->data)) {
return $this->data['categories'];
}
if ($this
->getType() !== Reader\Reader::TYPE_RSS_10 && $this
->getType() !== Reader\Reader::TYPE_RSS_090) {
$list = $this->xpath
->query($this->xpathQueryRss . '//category');
}
else {
$list = $this->xpath
->query($this->xpathQueryRdf . '//rss:category');
}
if ($list->length) {
$categoryCollection = new Reader\Collection\Category();
foreach ($list as $category) {
$categoryCollection[] = [
'term' => $category->nodeValue,
'scheme' => $category
->getAttribute('domain'),
'label' => $category->nodeValue,
];
}
}
else {
$categoryCollection = $this
->getExtension('DublinCore')
->getCategories();
}
if (count($categoryCollection) == 0) {
$categoryCollection = $this
->getExtension('Atom')
->getCategories();
}
$this->data['categories'] = $categoryCollection;
return $this->data['categories'];
}