/** * Compares two menu items and returns their sorting relation to each other * * @param Item $a First item * @param Item $b Second item * * @return integer 0 if order A = order B, -1 if order A < order B, 1 if order A > order B */ protected function compareItemOrder($a, $b) { $orderA = $a->getOrder(); $orderB = $b->getOrder(); if ($orderA == $orderB) { return 0; } return $orderA < $orderB ? -1 : 1; }
/** * Remove a submenu item * * @param Item $item The submenu item to remove * * @return void */ public function removeSubmenu(Item $item) { $this->removeSubmenuByName($item->getName()); }
/** * Remove a child menu item * * @param Item $item * * @return void */ public function removeChild(Item $item) { $key = $item->getName(); if (!array_key_exists($key, $this->children)) { return; } unset($this->children[$key]); }