public function AbstractFeed::addCategory in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/zendframework/zend-feed/src/Writer/AbstractFeed.php \Zend\Feed\Writer\AbstractFeed::addCategory()
Add a feed category
Parameters
array $category:
Return value
Throws
Exception\InvalidArgumentException
1 call to AbstractFeed::addCategory()
- AbstractFeed::addCategories in vendor/
zendframework/ zend-feed/ src/ Writer/ AbstractFeed.php - Set an array of feed categories
File
- vendor/
zendframework/ zend-feed/ src/ Writer/ AbstractFeed.php, line 483
Class
Namespace
Zend\Feed\WriterCode
public function addCategory(array $category) {
if (!isset($category['term'])) {
throw new Exception\InvalidArgumentException('Each category must be an array and ' . 'contain at least a "term" element containing the machine ' . ' readable category name');
}
if (isset($category['scheme'])) {
if (empty($category['scheme']) || !is_string($category['scheme']) || !Uri::factory($category['scheme'])
->isValid()) {
throw new Exception\InvalidArgumentException('The Atom scheme or RSS domain of' . ' a category must be a valid URI');
}
}
if (!isset($this->data['categories'])) {
$this->data['categories'] = [];
}
$this->data['categories'][] = $category;
return $this;
}