order = (int) $order; return $this; } public function getOrder() { return $this->order; } public function setId($id) { $this->id = $id; return $this; } public function getId() { return $this->id; } public function getDisplayName() { return Piwik::translate($this->getId()); } public function addSubcategory(Subcategory $subcategory) { $subcategoryId = $subcategory->getId(); if ($this->hasSubcategory($subcategoryId)) { throw new \Exception(sprintf('Subcategory %s already exists', $subcategoryId)); } $this->subcategories[$subcategoryId] = $subcategory; } public function hasSubcategory($subcategoryId) { return isset($this->subcategories[$subcategoryId]); } public function getSubcategory($subcategoryId) { if ($this->hasSubcategory($subcategoryId)) { return $this->subcategories[$subcategoryId]; } } /** * @return Subcategory[] */ public function getSubcategories() { return array_values($this->subcategories); } public function hasSubCategories() { return !empty($this->subcategories); } public function setIcon($icon) { $this->icon = $icon; return $this; } public function getIcon() { return $this->icon; } }