$this->namespaces
[$namespace] =
['id' =>
$namespace, 'commands' =>
$names];
} } private function sortCommands(array
$commands): array
{ $namespacedCommands =
[];
$globalCommands =
[];
$sortedCommands =
[];
foreach ($commands as $name =>
$command) { $key =
$this->application->
extractNamespace($name, 1
);
if (\
in_array($key,
['', self::GLOBAL_NAMESPACE
], true
)) { $globalCommands[$name] =
$command;
} else { $namespacedCommands[$key][$name] =
$command;
} } if ($globalCommands) { ksort($globalCommands);
$sortedCommands[self::GLOBAL_NAMESPACE
] =
$globalCommands;
}