protected function execute(InputInterface $input, OutputInterface $output) { $this->_collections = $this->get('routes'); $parents = array(); foreach ($this->_collections as $collectionName => $collection) { $parents[$collectionName] = $collection->getParent(); } $tree = Iterable::toTree($parents); $output->writeln('<info>Found ' . count($parents) . ' registered route collections.</info>'); $output->writeln(''); $output->writeln('<bold>ROOT</bold>'); $this->_printTree($output, $tree); $output->writeln(''); }
/** * Gets the parent collection names for each route collection. * * @return array An array where the key is the collection name and the * value is an array of the parent collection names. */ protected function _getCollectionHierarchy() { $parents = array(); foreach ($this as $collectionName => $collection) { $parents[$collectionName] = $collection->getParent(); } $tree = Iterable::toTree($parents); $keys = Iterable::arrayKeysMultidimensional($tree); $result = array(); foreach ($keys as $key) { $result[$key] = array_merge((array) Iterable::getParentsFromKey($key, $tree), array($key)); } return $result; }