/** * {@inheritdoc} */ public function addElement(NavigationInterface $element) { $id = $element->getId(); if (isset($this->elements[$id])) { throw new \LogicException(sprintf('Navigation with ID: "%s" already exists', $id)); } $this->elements[$id] = $element; return $this; }