public function Rss::getCategories in Zircon Profile 8.0
Same name in this branch
- 8.0 vendor/zendframework/zend-feed/src/Reader/Entry/Rss.php \Zend\Feed\Reader\Entry\Rss::getCategories()
- 8.0 vendor/zendframework/zend-feed/src/Reader/Feed/Rss.php \Zend\Feed\Reader\Feed\Rss::getCategories()
Same name and namespace in other branches
- 8 vendor/zendframework/zend-feed/src/Reader/Feed/Rss.php \Zend\Feed\Reader\Feed\Rss::getCategories()
Get all categories
Return value
Reader\Collection\Category
Overrides FeedInterface::getCategories
File
- vendor/
zendframework/ zend-feed/ src/ Reader/ Feed/ Rss.php, line 624
Class
Namespace
Zend\Feed\Reader\FeedCode
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('/rss/channel//category');
}
else {
$list = $this->xpath
->query('/rdf:RDF/rss:channel//rss:category');
}
if ($list->length) {
$categoryCollection = new 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'];
}