Command
extends AbstractCommand
in package
Console command class
Tags
Table of Contents
Properties
- $application : Application|null
- Application object
- $console : Console|null
- Console object
- $defaultAction : string
- Default action
- $help : string|null
- Command help
- $name : string|null
- Command name
- $params : string|null
- Command params
- $scriptName : string|null
- Script name the command was registered under (e.g. './app'), used to recover the command's bare, unprefixed name for subcommand matching
Methods
- __construct() : mixed
- Instantiate the command object
- __toString() : string
- Return the command name as string
- application() : Application|null
- Get application object (alias)
- console() : Console
- Get console object (alias)
- dispatch() : void
- Dispatch the command
- getApplication() : Application|null
- Get application object
- getConsole() : Console|null
- Get console object
- getDefaultAction() : string
- Get the default action
- getHelp() : string|null
- Get the command help
- getName() : string|null
- Get the command name
- getParams() : string|null
- Get the command params
- getScriptName() : string|null
- Get the script name the command was registered under
- hasApplication() : bool
- Has application object
- hasConsole() : bool
- Has console object
- hasHelp() : bool
- Determine if the command has help
- hasName() : bool
- Determine if the command has name
- hasParams() : bool
- Determine if the command has params
- hasScriptName() : bool
- Determine if the command has a script name
- setApplication() : static
- Set application object
- setConsole() : static
- Set console object
- setDefaultAction() : static
- Set the default action
- setHelp() : static
- Set the command help
- setName() : static
- Set the command name
- setParams() : static
- Set the command params
- setScriptName() : static
- Set the script name the command was registered under
Properties
$application
Application object
protected
Application|null
$application
= null
$console
Console object
protected
Console|null
$console
= null
$defaultAction
Default action
protected
string
$defaultAction
= 'error'
$help
Command help
protected
string|null
$help
= null
$name
Command name
protected
string|null
$name
= null
$params
Command params
protected
string|null
$params
= null
$scriptName
Script name the command was registered under (e.g. './app'), used to recover the command's bare, unprefixed name for subcommand matching
protected
string|null
$scriptName
= null
Methods
__construct()
Instantiate the command object
public
__construct([Application|null $application = null ][, Console $console = new Console(120) ][, string|null $name = null ][, string|null $params = null ][, string|null $help = null ]) : mixed
Parameters
- $application : Application|null = null
- $console : Console = new Console(120)
- $name : string|null = null
- $params : string|null = null
- $help : string|null = null
__toString()
Return the command name as string
public
__toString() : string
Return values
stringapplication()
Get application object (alias)
public
application() : Application|null
Return values
Application|nullconsole()
Get console object (alias)
public
console() : Console
Return values
Consoledispatch()
Dispatch the command
public
dispatch([string|null $action = null ][, array<string|int, mixed>|null $params = null ]) : void
Resolves to the 'handle' action when none is given, always passing it through as an explicit action name rather than relying on AbstractDispatcher's own default-action fallback, which does not forward $params.
Parameters
- $action : string|null = null
- $params : array<string|int, mixed>|null = null
getApplication()
Get application object
public
getApplication() : Application|null
Return values
Application|nullgetConsole()
Get console object
public
getConsole() : Console|null
Return values
Console|nullgetDefaultAction()
Get the default action
public
getDefaultAction() : string
Return values
stringgetHelp()
Get the command help
public
getHelp() : string|null
Return values
string|nullgetName()
Get the command name
public
getName() : string|null
Return values
string|nullgetParams()
Get the command params
public
getParams() : string|null
Return values
string|nullgetScriptName()
Get the script name the command was registered under
public
getScriptName() : string|null
Return values
string|nullhasApplication()
Has application object
public
hasApplication() : bool
Return values
boolhasConsole()
Has console object
public
hasConsole() : bool
Return values
boolhasHelp()
Determine if the command has help
public
hasHelp() : bool
Return values
boolhasName()
Determine if the command has name
public
hasName() : bool
Return values
boolhasParams()
Determine if the command has params
public
hasParams() : bool
Return values
boolhasScriptName()
Determine if the command has a script name
public
hasScriptName() : bool
Return values
boolsetApplication()
Set application object
public
setApplication(Application $application) : static
Parameters
- $application : Application
Return values
staticsetConsole()
Set console object
public
setConsole([Console $console = new Console(120) ]) : static
Parameters
- $console : Console = new Console(120)
Return values
staticsetDefaultAction()
Set the default action
public
setDefaultAction(string $default) : static
Parameters
- $default : string
Return values
staticsetHelp()
Set the command help
public
setHelp(string $help) : static
Parameters
- $help : string
Return values
staticsetName()
Set the command name
public
setName(string $name) : static
Parameters
- $name : string
Return values
staticsetParams()
Set the command params
public
setParams(string $params) : static
Parameters
- $params : string
Return values
staticsetScriptName()
Set the script name the command was registered under
public
setScriptName(string $scriptName) : static
Parameters
- $scriptName : string