public function handle(Menu $menu, $project, $ref) { $project = $project instanceof Project ? $project : $this->codex->projects->get($project); $ref = $ref instanceof Ref ? $ref : $project->refs->get($ref); $this->menu = $menu; $this->project = $project; $this->ref = $ref; $menu->setView($this->codex->view('menus.sidebar')); $this->menu->clear(); $items = $ref->config('menu', []); if (!is_array($items)) { throw CodexException::invalidMenuConfiguration(": menu.yml in [{$this}]"); } $this->recurse($items); }