public function getAllItems() { $arItems = []; foreach ($this->menu as $item) { $arItems[$item->getId()] = $item; if ($item->length() > 0) { $arItems = $arItems + $item->getAllItems(); } } return $arItems; }