A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.yiiframework.com/doc/api/2.0/yii-console-unknowncommandexception below:

UnknownCommandException, yii\console\UnknownCommandException | API Documentation for Yii 2.0

Class yii\console\UnknownCommandException

UnknownCommandException represents an exception caused by incorrect usage of a console command.

Property Details Method Details

Hide inherited methods

__construct()

public method

Construct the exception.

public void __construct ( $route, $application, $code 0, $previous null ) $route string

The route of the command that could not be found.

$application yii\console\Application

The console application instance involved.

$code integer

The Exception code.

$previous Throwable|null

The previous exception used for the exception chaining.

Source code

                public function __construct($route, $application, $code = 0, $previous = null)
{
    $this->command = $route;
    $this->application = $application;
    parent::__construct("Unknown command \"$route\".", $code, $previous);
}

            

Source code

                public function getName()
{
    return 'Unknown command';
}

            

getSuggestedAlternatives()

public method

Suggest alternative commands for $command based on string similarity.

Alternatives are searched using the following steps:

See also https://www.php.net/manual/en/function.levenshtein.php.

Source code

                public function getSuggestedAlternatives()
{
    $help = $this->application->createController('help');
    if ($help === false || $this->command === '') {
        return [];
    }
    /** @var $helpController HelpController */
    list($helpController, $actionID) = $help;
    $availableActions = [];
    foreach ($helpController->getCommands() as $command) {
        $result = $this->application->createController($command);
        /** @var $controller Controller */
        list($controller, $actionID) = $result;
        if ($controller->createAction($controller->defaultAction) !== null) {
            // add the command itself (default action)
            $availableActions[] = $command;
        }
        // add all actions of this controller
        $actions = $helpController->getActions($controller);
        $prefix = $controller->getUniqueId();
        foreach ($actions as $action) {
            $availableActions[] = $prefix . '/' . $action;
        }
    }
    return $this->filterBySimilarity($availableActions, $this->command);
}

            

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4