PHP Class yii\console\controllers\HelpController

This command displays the available command list in the application or the detailed instructions about using a specific command. This command can be used as follows on command line: yii help [command name] In the above, if the command name is not provided, all available commands will be displayed.
Since: 2.0
Author: Qiang Xue ([email protected])
Inheritance: extends yii\console\Controller
Show file Open project: yiisoft/yii2 Class Usage Examples

Public Methods

Method Description
actionIndex ( string $command = null ) : integer Displays available commands or the detailed information about a particular command.
getActions ( Controller $controller ) : array Returns all available actions of the specified controller.
getCommands ( ) : array Returns all available command names.

Protected Methods

Method Description
formatOptionAliases ( Controller $controller, string $option ) : string
formatOptionHelp ( string $name, boolean $required, string $type, mixed $defaultValue, string $comment ) : string Generates a well-formed string for an argument or option.
getCommandDescriptions ( ) : array Returns an array of commands an their descriptions.
getCommandHelp ( Controller $controller ) Displays the overall information of the command.
getDefaultHelp ( ) Displays all available commands.
getDefaultHelpHeader ( ) : string Return a default help header.
getModuleCommands ( Module $module ) : array Returns available commands of a specified module.
getScriptName ( ) : string
getSubCommandHelp ( Controller $controller, string $actionID ) Displays the detailed information of a command action.
validateControllerClass ( string $controllerClass ) : boolean Validates if the given class is a valid console controller class.

Method Details

actionIndex() public method

Displays available commands or the detailed information about a particular command.
public actionIndex ( string $command = null ) : integer
$command string The name of the command to show help about. If not provided, all available commands will be displayed.
return integer the exit status

formatOptionAliases() protected method

Since: 2.0.8
protected formatOptionAliases ( Controller $controller, string $option ) : string
$controller yii\console\Controller the controller instance
$option string the option name
return string the formatted string for the alias argument or option

formatOptionHelp() protected method

Generates a well-formed string for an argument or option.
protected formatOptionHelp ( string $name, boolean $required, string $type, mixed $defaultValue, string $comment ) : string
$name string the name of the argument or option
$required boolean whether the argument is required
$type string the type of the option or argument
$defaultValue mixed the default value of the option or argument
$comment string comment about the option or argument
return string the formatted string for the argument or option

getActions() public method

Returns all available actions of the specified controller.
public getActions ( Controller $controller ) : array
$controller yii\console\Controller the controller instance
return array all available action IDs.

getCommandDescriptions() protected method

Returns an array of commands an their descriptions.
protected getCommandDescriptions ( ) : array
return array all available commands as keys and their description as values.

getCommandHelp() protected method

Displays the overall information of the command.
protected getCommandHelp ( Controller $controller )
$controller yii\console\Controller the controller instance

getCommands() public method

Returns all available command names.
public getCommands ( ) : array
return array all available command names

getDefaultHelp() protected method

Displays all available commands.
protected getDefaultHelp ( )

getDefaultHelpHeader() protected method

Return a default help header.
Since: 2.0.11
protected getDefaultHelpHeader ( ) : string
return string default help header.

getModuleCommands() protected method

Returns available commands of a specified module.
protected getModuleCommands ( Module $module ) : array
$module yii\base\Module the module instance
return array the available command names

getScriptName() protected method

protected getScriptName ( ) : string
return string the name of the cli script currently running.

getSubCommandHelp() protected method

Displays the detailed information of a command action.
protected getSubCommandHelp ( Controller $controller, string $actionID )
$controller yii\console\Controller the controller instance
$actionID string action ID

validateControllerClass() protected method

Validates if the given class is a valid console controller class.
protected validateControllerClass ( string $controllerClass ) : boolean
$controllerClass string
return boolean