dispatcher = $dispatcher; $this->factory = $factory; } public function sourceNavbar(RequestStack $request): ItemInterface { $menu = $this->createBasicMenuItem(); $this->dispatcher->dispatch(MenuEventType::SOURCE, new MenuEvent($this->factory, $menu, $request)); return $menu; } public function nodeSubbar(RequestStack $request): ItemInterface { $menu = $this->createBasicMenuItem(); $this->dispatcher->dispatch(MenuEventType::NODE, new MenuEvent($this->factory, $menu, $request)); return $menu; } public function userTopbar(RequestStack $request): ItemInterface { $menu = $this->createBasicMenuItem(); $this->dispatcher->dispatch(MenuEventType::USER, new MenuEvent($this->factory, $menu, $request)); return $menu; } private function createBasicMenuItem():ItemInterface{ return $this->factory->createItem('root', [ 'childrenAttributes' => [ 'class' => 'navbar-nav mr-auto', ], ]); } }