protected function buildCommandsIndex(array $commands)
    {
        $commandsByPackagesAndControllers = [];
        /** @var Command $command */
        foreach ($commands as $command) {
            if ($command->isInternal()) {
                continue;
            }
            $commandIdentifier = $command->getCommandIdentifier();
            $packageKey = strstr($commandIdentifier, ':', true);
            $commandControllerClassName = $command->getControllerClassName();
            $commandName = $command->getControllerCommandName();
            $commandsByPackagesAndControllers[$packageKey][$commandControllerClassName][$commandName] = $command;
        }
        return $commandsByPackagesAndControllers;
    }
protected function buildCommandsIndex(array $commands)
    {
        $commandsByPackagesAndControllers = [];
        /** @var Command $command */
        foreach ($commands as $command) {
            if ($command->isInternal()) {
                continue;
            }
            $commandIdentifier = $command->getCommandIdentifier();
            $packageKey = strstr($commandIdentifier, ':', true);
            $commandControllerClassName = $command->getControllerClassName();
            $commandName = $command->getControllerCommandName();
            $commandsByPackagesAndControllers[$packageKey][$commandControllerClassName][$commandName] = $command;
        }
        return $commandsByPackagesAndControllers;
    }
protected function buildCommandsIndex ( array $ commands ) { $ commandsByPackagesAndControllers = [ ] ; /** @var Command $command */ foreach ( $ commands as $ command ) { if ( $ command -> isInternal ( ) ) { continue ; } $ commandIdentifier = $ command -> getCommandIdentifier ( ) ; $ packageKey = strstr ( $ commandIdentifier , ':' , true ) ; $ commandControllerClassName = $ command -> getControllerClassName ( ) ; $ commandName = $ command -> getControllerCommandName ( ) ; $ commandsByPackagesAndControllers [ $ packageKey ] [ $ commandControllerClassName ] [ $ commandName ] = $ command ; } return $ commandsByPackagesAndControllers ; }
Builds an index of available commands. For each of them a Command object is
added to the commands array of this class.

@param array<Command> $commands
@return array in the format array('<packageKey>' => array('<CommandControllerClassName>', array('<command1>' => $command1, '<command2>' => $command2)))
Builds an index of available commands . For each of them a Command object is added to the commands array of this class .