src/Console/UnknownCommandException.php
public function getSuggestedAlternatives()
    {
        $help = Reaction::$app->router->createController('help', ['app' => $this->app], false);
        if ($help[0] === null || $this->command === '') {
            return [];
        }
        /** @var $helpController HelpController */
        list($helpController, $actionID) = $help;

        $availableActions = [];
        foreach ($helpController->getCommands() as $command) {
            $result = Reaction::$app->router->createController($command, ['app' => $this->app], false);
            if ($result[0] === null) {
                continue;
            }
            // add the command itself (default action)
            $availableActions[] = $command;

            // add all actions of this controller
            /** @var $controller Reaction\Console\Routes\Controller */
            list($controller, $actionID) = $result;
            $actions = $helpController->getActions($controller);
            if (!empty($actions)) {
                $prefix = $controller->getUniqueId();
                foreach ($actions as $action) {
                    $availableActions[] = $prefix . '/' . $action;
                }
            }
        }

        return $this->filterBySimilarity($availableActions, $this->command);
    }
public function getSuggestedAlternatives()
    {
        $help = Reaction::$app->router->createController('help', ['app' => $this->app], false);
        if ($help[0] === null || $this->command === '') {
            return [];
        }
        /** @var $helpController HelpController */
        list($helpController, $actionID) = $help;

        $availableActions = [];
        foreach ($helpController->getCommands() as $command) {
            $result = Reaction::$app->router->createController($command, ['app' => $this->app], false);
            if ($result[0] === null) {
                continue;
            }
            // add the command itself (default action)
            $availableActions[] = $command;

            // add all actions of this controller
            /** @var $controller Reaction\Console\Routes\Controller */
            list($controller, $actionID) = $result;
            $actions = $helpController->getActions($controller);
            if (!empty($actions)) {
                $prefix = $controller->getUniqueId();
                foreach ($actions as $action) {
                    $availableActions[] = $prefix . '/' . $action;
                }
            }
        }

        return $this->filterBySimilarity($availableActions, $this->command);
    }
Suggest alternative commands for [[$command]] based on string similarity.

Alternatives are searched using the following steps:

- suggest alternatives that begin with `$command`
- find typos by calculating the Levenshtein distance between the unknown command and all
available commands. The Levenshtein distance is defined as the minimal number of
characters you have to replace, insert or delete to transform str1 into str2.

@see http://php.net/manual/en/function.levenshtein.php
@return array a list of suggested alternatives sorted by similarity.