items[$id] = $item; return $item; } /** * Zwraca elementu menu o podanym id * * @param string $id Id elementu menu * @return stNavigationMenuItem */ public function getItem($id) { if (!isset($this->items[$id])) { throw new Exception(sprintf('Item "%s" does not exist', $id)); } return $this->items[$id]; } /** * Zwraca tablicę elementów menu * * @return stNavigationMenuItem[] */ public function getItems() { return $this->items; } public function current() { return current($this->items); } public function next() { return next($this->items); } public function key() { return key($this->items); } public function valid() { return null !== $this->key(); } public function rewind() { return reset($this->items); } public function count() { return count($this->items); } }