/** * @param \ViKon\Menu\Component\AbstractComponent $component * * @return $this */ public function addComponent(AbstractComponent $component) { $component->setMenuBuilder($this); $component->setContainer($this->container); $this->components[$component->getToken()] = $component; return $this; }
/** * @param \ViKon\Menu\Component\AbstractComponent $nestedComponent * * @return $this */ public function addNestedComponent(AbstractComponent $nestedComponent) { $this->nestedComponents[$nestedComponent->getToken()] = $nestedComponent; /** @type \ViKon\Menu\Component\AbstractComponent $this */ if ($this->getMenuBuilder() !== null) { $nestedComponent->setMenuBuilder($this->getMenuBuilder()); } if ($this->getContainer() !== null) { $nestedComponent->setContainer($this->getContainer()); } return $this; }