$application
$application :
ListCommand displays the list of all available commands for the application.
setApplication(\Symfony\Component\Console\Application $application = null)
Sets the application instance for this command.
SymfonyComponentConsoleApplication | $application |
An Application instance |
setHelperSet(\Symfony\Component\Console\Helper\HelperSet $helperSet)
Sets the helper set.
SymfonyComponentConsoleHelperHelperSet | $helperSet |
A HelperSet instance |
getHelperSet() : \Symfony\Component\Console\Helper\HelperSet
Gets the helper set.
A HelperSet instance
getApplication() : \Symfony\Component\Console\Application
Gets the application instance for this command.
An Application instance
run(\Symfony\Component\Console\Input\InputInterface $input, \Symfony\Component\Console\Output\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.
SymfonyComponentConsoleInputInputInterface | $input |
An InputInterface instance |
SymfonyComponentConsoleOutputOutputInterface | $output |
An OutputInterface instance |
setCode(\Closure $code) : \Symfony\Component\Console\Command\Command
Sets the code to execute when running this command.
If this method is used, it overrides the code defined in the execute() method.
Closure | $code |
A Closure |
The current instance
setDefinition(array|\Symfony\Component\Console\Input\InputDefinition $definition) : \Symfony\Component\Console\Command\Command
Sets an array of argument and option instances.
array|SymfonyComponentConsoleInputInputDefinition | $definition |
An array of argument and option instances or a definition instance |
The current instance
getDefinition() : \Symfony\Component\Console\Input\InputDefinition
Gets the InputDefinition attached to this Command.
An InputDefinition instance
addArgument(string $name, integer $mode = null, string $description = '', mixed $default = null) : \Symfony\Component\Console\Command\Command
Adds an argument.
string | $name |
The argument name |
integer | $mode |
The argument mode: InputArgument::REQUIRED or InputArgument::OPTIONAL |
string | $description |
A description text |
mixed | $default |
The default value (for InputArgument::OPTIONAL mode only) |
The current instance
addOption(string $name, string $shortcut = null, integer $mode = null, string $description = '', mixed $default = null) : \Symfony\Component\Console\Command\Command
Adds an option.
string | $name |
The option name |
string | $shortcut |
The shortcut (can be null) |
integer | $mode |
The option mode: One of the InputOption::VALUE_* constants |
string | $description |
A description text |
mixed | $default |
The default value (must be null for InputOption::VALUE_REQUIRED or InputOption::VALUE_NONE) |
The current instance
setName(string $name) : \Symfony\Component\Console\Command\Command
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');
string | $name |
The command name |
When command name given is empty
The current instance
setDescription(string $description) : \Symfony\Component\Console\Command\Command
Sets the description for the command.
string | $description |
The description for the command |
The current instance
setHelp(string $help) : \Symfony\Component\Console\Command\Command
Sets the help for the command.
string | $help |
The help for the command |
The current instance
setAliases(array $aliases) : \Symfony\Component\Console\Command\Command
Sets the aliases for the command.
array | $aliases |
An array of aliases for the command |
The current instance
asXml(Boolean $asDom = false) : string|\Symfony\Component\Console\Command\DOMDocument
Returns an XML representation of the command.
Boolean | $asDom |
Whether to return a DOM or an XML string |
An XML string representing the command
execute(\Symfony\Component\Console\Input\InputInterface $input, \Symfony\Component\Console\Output\OutputInterface $output) : integer
Executes the current command.
This method is not abstract because you can use this class as a concrete class. In this case, instead of defining the execute() method, you set the code to execute by passing a Closure to the setCode() method.
SymfonyComponentConsoleInputInputInterface | $input |
An InputInterface instance |
SymfonyComponentConsoleOutputOutputInterface | $output |
An OutputInterface instance |
0 if everything went fine, or an error code
interact(\Symfony\Component\Console\Input\InputInterface $input, \Symfony\Component\Console\Output\OutputInterface $output)
Interacts with the user.
SymfonyComponentConsoleInputInputInterface | $input |
An InputInterface instance |
SymfonyComponentConsoleOutputOutputInterface | $output |
An OutputInterface instance |
initialize(\Symfony\Component\Console\Input\InputInterface $input, \Symfony\Component\Console\Output\OutputInterface $output)
Initializes the command just after the input has been validated.
This is mainly useful when a lot of commands extends one main command where some things need to be initialized based on the input arguments and options.
SymfonyComponentConsoleInputInputInterface | $input |
An InputInterface instance |
SymfonyComponentConsoleOutputOutputInterface | $output |
An OutputInterface instance |
getNativeDefinition() : \Symfony\Component\Console\Input\InputDefinition
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.
An InputDefinition instance
Documentation created by phpDocumentor