class HelpCommand extends Command
HelpCommand displays the help for a given command.
Methods
|
__construct(string $name = null)
Constructor. |
from Command | |
|
ignoreValidationErrors()
Ignores validation errors. |
from Command | |
|
setApplication(Application $application = null)
Sets the application instance for this command. |
from Command | |
|
setHelperSet(HelperSet $helperSet)
Sets the helper set. |
from Command | |
| HelperSet |
getHelperSet()
Gets the helper set. |
from Command |
| Application |
getApplication()
Gets the application instance for this command. |
from Command |
| Boolean |
isEnabled()
Checks whether the command is enabled or not in the current environment |
from Command |
| integer |
run(InputInterface $input, OutputInterface $output)
Runs the command. |
from Command |
| Command |
setCode(callable $code)
Sets the code to execute when running this command. |
from Command |
|
mergeApplicationDefinition(Boolean $mergeArgs = true)
Merges the application definition with the command definition. |
from Command | |
| Command |
setDefinition(array|InputDefinition $definition)
Sets an array of argument and option instances. |
from Command |
| InputDefinition |
getDefinition()
Gets the InputDefinition attached to this Command. |
from Command |
| InputDefinition |
getNativeDefinition()
Gets the InputDefinition to be used to create XML and Text representations of this Command. |
from Command |
| Command |
addArgument(string $name, integer $mode = null, string $description = '', mixed $default = null)
Adds an argument. |
from Command |
| Command |
addOption(string $name, string $shortcut = null, integer $mode = null, string $description = '', mixed $default = null)
Adds an option. |
from Command |
| Command |
setName(string $name)
Sets the name of the command. |
from Command |
| string |
getName()
Returns the command name. |
from Command |
| Command |
setDescription(string $description)
Sets the description for the command. |
from Command |
| string |
getDescription()
Returns the description for the command. |
from Command |
| Command |
setHelp(string $help)
Sets the help for the command. |
from Command |
| string |
getHelp()
Returns the help for the command. |
from Command |
| string |
getProcessedHelp()
Returns the processed help for the command replacing the %command.name% and %command.full_name% patterns with the real values dynamically. |
from Command |
| Command |
setAliases(array $aliases)
Sets the aliases for the command. |
from Command |
| array |
getAliases()
Returns the aliases for the command. |
from Command |
| string |
getSynopsis()
Returns the synopsis for the command. |
from Command |
| mixed |
getHelper(string $name)
Gets a helper instance by name. |
from Command |
| string |
asText()
Returns a text representation of the command. |
from Command |
| string|DOMDocument |
asXml(Boolean $asDom = false)
Returns an XML representation of the command. |
from Command |
|
setCommand(Command $command)
Sets the command |
Details
in Command at line 55
public
__construct(string $name = null)
Constructor.
in Command at line 79
public
ignoreValidationErrors()
Ignores validation errors.
This is mainly useful for the help command.
in Command at line 91
public
setApplication(Application $application = null)
Sets the application instance for this command.
in Command at line 106
public
setHelperSet(HelperSet $helperSet)
Sets the helper set.
in Command at line 116
public HelperSet
getHelperSet()
Gets the helper set.
in Command at line 128
public Application
getApplication()
Gets the application instance for this command.
in Command at line 141
public Boolean
isEnabled()
Checks whether the command is enabled or not in the current environment
Override this to check for x or y and return false if the command can not
run properly under the current conditions.
in Command at line 216
public integer
run(InputInterface $input, OutputInterface $output)
Runs the command.
The code to execute is either defined directly with the
setCode() method or by overriding the execute() method
in a sub-class.
in Command at line 266
public Command
setCode(callable $code)
Sets the code to execute when running this command.
If this method is used, it overrides the code defined
in the execute() method.
in Command at line 284
public
mergeApplicationDefinition(Boolean $mergeArgs = true)
Merges the application definition with the command definition.
This method is not part of public API and should not be used directly.
in Command at line 313
public Command
setDefinition(array|InputDefinition $definition)
Sets an array of argument and option instances.
in Command at line 333
public InputDefinition
getDefinition()
Gets the InputDefinition attached to this Command.
in Command at line 348
public InputDefinition
getNativeDefinition()
Gets the InputDefinition to be used to create XML and Text representations of this Command.
Can be overridden to provide the original command representation when it would otherwise
be changed by merging with the application InputDefinition.
This method is not part of public API and should not be used directly.
in Command at line 365
public Command
addArgument(string $name, integer $mode = null, string $description = '', mixed $default = null)
Adds an argument.
in Command at line 385
public Command
addOption(string $name, string $shortcut = null, integer $mode = null, string $description = '', mixed $default = null)
Adds an option.
in Command at line 408
public Command
setName(string $name)
Sets the name of the command.
This method can set both the namespace and the name if
you separate them by a colon (:)
$command->setName('foo:bar');
in Command at line 424
public string
getName()
Returns the command name.
in Command at line 438
public Command
setDescription(string $description)
Sets the description for the command.
in Command at line 452
public string
getDescription()
Returns the description for the command.
in Command at line 466
public Command
setHelp(string $help)
Sets the help for the command.
in Command at line 480
public string
getHelp()
Returns the help for the command.
in Command at line 491
public string
getProcessedHelp()
Returns the processed help for the command replacing the %command.name% and %command.full_name% patterns with the real values dynamically.
in Command at line 516
public Command
setAliases(array $aliases)
Sets the aliases for the command.
in Command at line 534
public array
getAliases()
Returns the aliases for the command.
in Command at line 544
public string
getSynopsis()
Returns the synopsis for the command.
in Command at line 564
public mixed
getHelper(string $name)
Gets a helper instance by name.
in Command at line 576
public string
asText()
Returns a text representation of the command.
in Command at line 592
public string|DOMDocument
asXml(Boolean $asDom = false)
Returns an XML representation of the command.
at line 65
public
setCommand(Command $command)
Sets the command