HumHub Documentation (unofficial)

UnknownCommandException extends Exception
in package

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

Tags
author

Carsten Brandt mail@cebe.cc

since
2.0.11

Table of Contents

Properties

$command  : string
$application  : Application

Methods

__construct()  : mixed
Construct the exception.
getName()  : string
getSuggestedAlternatives()  : array<string|int, mixed>
Suggest alternative commands for [[$command]] based on string similarity.
filterBySimilarity()  : array<string|int, mixed>
Find suggest alternative commands based on string similarity.

Properties

Methods

__construct()

Construct the exception.

public __construct(string $route, Application $application[, int $code = 0 ][, Throwable|null $previous = null ]) : mixed
Parameters
$route : string

the route of the command that could not be found.

$application : Application

the console application instance involved.

$code : int = 0

the Exception code.

$previous : Throwable|null = null

the previous exception used for the exception chaining.

getName()

public getName() : string
Return values
string

the user-friendly name of this exception

getSuggestedAlternatives()

Suggest alternative commands for [[$command]] based on string similarity.

public getSuggestedAlternatives() : array<string|int, mixed>

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.
Tags
see
https://www.php.net/manual/en/function.levenshtein.php
Return values
array<string|int, mixed>

a list of suggested alternatives sorted by similarity.

filterBySimilarity()

Find suggest alternative commands based on string similarity.

private filterBySimilarity(array<string|int, mixed> $actions, string $command) : array<string|int, mixed>

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.
Parameters
$actions : array<string|int, mixed>

available command names.

$command : string

the command to compare to.

Tags
see
https://www.php.net/manual/en/function.levenshtein.php
Return values
array<string|int, mixed>

a list of suggested alternatives sorted by similarity.


        
On this page

Search results