src/Viserio/Component/Console/Helper/TextDescriptor.php
private function getNamespaceSortedCommandInfos(array $commands): array
    {
        $namespaceSortedInfos = [];
        $regex                = '/^(.*)\:/';
        $binary               = Application::cerebroBinary();

        /** @var AbstractCommand $command */
        foreach ($commands as $name => $command) {
            \preg_match($regex, $name, $matches, \PREG_OFFSET_CAPTURE);

            $commandInfo = [
                'command'     => $binary . ' ' . $command->getSynopsis(),
                'description' => $command->getDescription(),
            ];

            if (\count($matches) === 0) {
                $namespaceSortedInfos[$name][] = $commandInfo;
            } else {
                $namespaceSortedInfos[$matches[1][0]][] = $commandInfo;
            }
        }

        return $namespaceSortedInfos;
    }
private function getNamespaceSortedCommandInfos(array $commands): array
    {
        $namespaceSortedInfos = [];
        $regex                = '/^(.*)\:/';
        $binary               = Application::cerebroBinary();

        /** @var AbstractCommand $command */
        foreach ($commands as $name => $command) {
            \preg_match($regex, $name, $matches, \PREG_OFFSET_CAPTURE);

            $commandInfo = [
                'command'     => $binary . ' ' . $command->getSynopsis(),
                'description' => $command->getDescription(),
            ];

            if (\count($matches) === 0) {
                $namespaceSortedInfos[$name][] = $commandInfo;
            } else {
                $namespaceSortedInfos[$matches[1][0]][] = $commandInfo;
            }
        }

        return $namespaceSortedInfos;
    }
Sort all application commands on namespace.

@param array $commands

@return array