/** * Recursively finds current item. * * @param ioMenuItem $item Item to start from * @return ioMenuItem current item or null */ protected function findCurrentItem(ioMenuItem $item) { if ($item->matchCurrentLocation($this)) { return $item; } foreach ($item->getChildren() as $child) { $current = $this->findCurrentItem($child); if ($current) { return $current; } } return null; }