protected function getShortCommandIdentifiers(): array
    {
        if ($this->shortCommandIdentifiers === null) {
            $this->shortCommandIdentifiers = [];
            $commandsByCommandName = [];
            /** @var Command $availableCommand */
            foreach ($this->getAvailableCommands() as $availableCommand) {
                list($packageKey, $controllerName, $commandName) = explode(':', $availableCommand->getCommandIdentifier());
                if (!isset($commandsByCommandName[$commandName])) {
                    $commandsByCommandName[$commandName] = [];
                }
                if (!isset($commandsByCommandName[$commandName][$controllerName])) {
                    $commandsByCommandName[$commandName][$controllerName] = [];
                }
                $commandsByCommandName[$commandName][$controllerName][] = $packageKey;
            }
            foreach ($this->getAvailableCommands() as $availableCommand) {
                list($packageKey, $controllerName, $commandName) = explode(':', $availableCommand->getCommandIdentifier());
                if (count($commandsByCommandName[$commandName][$controllerName]) > 1 || $this->bootstrap->isCompiletimeCommand($availableCommand->getCommandIdentifier())) {
                    $packageKeyParts = array_reverse(explode('.', $packageKey));
                    for ($i = 1; $i <= count($packageKeyParts); $i++) {
                        $shortCommandIdentifier = implode('.', array_slice($packageKeyParts, 0, $i)) . ':' . $controllerName . ':' . $commandName;
                        try {
                            $this->getCommandByIdentifier($shortCommandIdentifier);
                            $this->shortCommandIdentifiers[$availableCommand->getCommandIdentifier()] = $shortCommandIdentifier;
                            break;
                        } catch (CommandException $exception) {
                        }
                    }
                } else {
                    $this->shortCommandIdentifiers[$availableCommand->getCommandIdentifier()] = sprintf('%s:%s', $controllerName, $commandName);
                }
            }
        }

        return $this->shortCommandIdentifiers;
    }
protected function getShortCommandIdentifiers(): array
    {
        if ($this->shortCommandIdentifiers === null) {
            $this->shortCommandIdentifiers = [];
            $commandsByCommandName = [];
            /** @var Command $availableCommand */
            foreach ($this->getAvailableCommands() as $availableCommand) {
                list($packageKey, $controllerName, $commandName) = explode(':', $availableCommand->getCommandIdentifier());
                if (!isset($commandsByCommandName[$commandName])) {
                    $commandsByCommandName[$commandName] = [];
                }
                if (!isset($commandsByCommandName[$commandName][$controllerName])) {
                    $commandsByCommandName[$commandName][$controllerName] = [];
                }
                $commandsByCommandName[$commandName][$controllerName][] = $packageKey;
            }
            foreach ($this->getAvailableCommands() as $availableCommand) {
                list($packageKey, $controllerName, $commandName) = explode(':', $availableCommand->getCommandIdentifier());
                if (count($commandsByCommandName[$commandName][$controllerName]) > 1 || $this->bootstrap->isCompiletimeCommand($availableCommand->getCommandIdentifier())) {
                    $packageKeyParts = array_reverse(explode('.', $packageKey));
                    for ($i = 1; $i <= count($packageKeyParts); $i++) {
                        $shortCommandIdentifier = implode('.', array_slice($packageKeyParts, 0, $i)) . ':' . $controllerName . ':' . $commandName;
                        try {
                            $this->getCommandByIdentifier($shortCommandIdentifier);
                            $this->shortCommandIdentifiers[$availableCommand->getCommandIdentifier()] = $shortCommandIdentifier;
                            break;
                        } catch (CommandException $exception) {
                        }
                    }
                } else {
                    $this->shortCommandIdentifiers[$availableCommand->getCommandIdentifier()] = sprintf('%s:%s', $controllerName, $commandName);
                }
            }
        }

        return $this->shortCommandIdentifiers;
    }
protected function getShortCommandIdentifiers ( ) : array { if ( $ this -> shortCommandIdentifiers === null ) { $ this -> shortCommandIdentifiers = [ ] ; $ commandsByCommandName = [ ] ; /** @var Command $availableCommand */ foreach ( $ this -> getAvailableCommands ( ) as $ availableCommand ) { list ( $ packageKey , $ controllerName , $ commandName ) = explode ( ':' , $ availableCommand -> getCommandIdentifier ( ) ) ; if ( ! isset ( $ commandsByCommandName [ $ commandName ] ) ) { $ commandsByCommandName [ $ commandName ] = [ ] ; } if ( ! isset ( $ commandsByCommandName [ $ commandName ] [ $ controllerName ] ) ) { $ commandsByCommandName [ $ commandName ] [ $ controllerName ] = [ ] ; } $ commandsByCommandName [ $ commandName ] [ $ controllerName ] [ ] = $ packageKey ; } foreach ( $ this -> getAvailableCommands ( ) as $ availableCommand ) { list ( $ packageKey , $ controllerName , $ commandName ) = explode ( ':' , $ availableCommand -> getCommandIdentifier ( ) ) ; if ( count ( $ commandsByCommandName [ $ commandName ] [ $ controllerName ] ) > 1 || $ this -> bootstrap -> isCompiletimeCommand ( $ availableCommand -> getCommandIdentifier ( ) ) ) { $ packageKeyParts = array_reverse ( explode ( '.' , $ packageKey ) ) ; for ( $ i = 1 ; $ i <= count ( $ packageKeyParts ) ; $ i ++ ) { $ shortCommandIdentifier = implode ( '.' , array_slice ( $ packageKeyParts , 0 , $ i ) ) . ':' . $ controllerName . ':' . $ commandName ; try { $ this -> getCommandByIdentifier ( $ shortCommandIdentifier ) ; $ this -> shortCommandIdentifiers [ $ availableCommand -> getCommandIdentifier ( ) ] = $ shortCommandIdentifier ; break ; } catch ( CommandException $ exception ) { } } } else { $ this -> shortCommandIdentifiers [ $ availableCommand -> getCommandIdentifier ( ) ] = sprintf ( '%s:%s' , $ controllerName , $ commandName ) ; } } } return $ this -> shortCommandIdentifiers ; }
Returns an array that contains all available command identifiers and their shortest non-ambiguous alias

@return array in the format array('full.command:identifier1' => 'alias1', 'full.command:identifier2' => 'alias2')
Returns an array that contains all available command identifiers and their shortest non - ambiguous alias