public function Entry::addCategory in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/zendframework/zend-feed/src/Writer/Entry.php \Zend\Feed\Writer\Entry::addCategory()
Add an entry category
Parameters
array $category:
Return value
Throws
Exception\InvalidArgumentException
1 call to Entry::addCategory()
- Entry::addCategories in vendor/
zendframework/ zend-feed/ src/ Writer/ Entry.php - Set an array of entry categories
File
- vendor/
zendframework/ zend-feed/ src/ Writer/ Entry.php, line 538
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;
}