protected function isOnLastLevelOfMenu(NodeInterface $menuItemNode) { if ($this->currentLevel >= $this->getMaximumLevels()) { return true; } if ($this->getLastLevel() !== null) { if ($this->getNodeLevelInSite($menuItemNode) >= $this->calculateNodeDepthFromRelativeLevel($this->getLastLevel(), $this->currentNode)) { return true; } } return false; }