private function ApplicationDescription::sortCommands in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/console/Descriptor/ApplicationDescription.php \Symfony\Component\Console\Descriptor\ApplicationDescription::sortCommands()
Parameters
array $commands:
Return value
array
1 call to ApplicationDescription::sortCommands()
- ApplicationDescription::inspectApplication in vendor/
symfony/ console/ Descriptor/ ApplicationDescription.php
File
- vendor/
symfony/ console/ Descriptor/ ApplicationDescription.php, line 136
Class
- ApplicationDescription
- @author Jean-François Simon <jeanfrancois.simon@sensiolabs.com>
Namespace
Symfony\Component\Console\DescriptorCode
private function sortCommands(array $commands) {
$namespacedCommands = array();
$globalCommands = array();
foreach ($commands as $name => $command) {
$key = $this->application
->extractNamespace($name, 1);
if (!$key) {
$globalCommands['_global'][$name] = $command;
}
else {
$namespacedCommands[$key][$name] = $command;
}
}
ksort($namespacedCommands);
$namespacedCommands = array_merge($globalCommands, $namespacedCommands);
foreach ($namespacedCommands as &$commandsSet) {
ksort($commandsSet);
}
// unset reference to keep scope clear
unset($commandsSet);
return $namespacedCommands;
}