/** * Get max priority. * * @param NodeInterface $parent * * @return int */ private function getMaxPriority(NodeInterface $parent) { $priority = 0; foreach ($parent->getChildren() as $child) { $priority = max($priority, $child->getPriority()); } return $priority; }
/** * Set invisible route. * * @param string $locale * @param NodeInterface $node */ public function setInvisible($locale, NodeInterface $node) { $translation = $node->getTranslation($locale); if (null !== $translation && null !== ($route = $translation->getRoute())) { $route->setVisible(false); } if ($this->recursiveInvisible) { foreach ($node->getChildren() as $child) { $this->setInvisible($locale, $child); } } }
/** * Recursive delete node children. * * @param TreeNodeInterface $node */ private function recursiveDelete(TreeNodeInterface $node) { foreach ($node->getChildren() as $child) { $this->recursiveDelete($child); } $this->repository->removeFromTree($node); }
/** * Has node children. * * @param NodeInterface $node * * @return bool */ private function hasChildren(NodeInterface $node) { return count($node->getChildren()) ? true : false; }