Command::setCode()

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. Parameters callable $code A callable(InputInterface $input, OutputInterface $output) Return Value Command The current instance Exceptions InvalidArgumentException See also execute()

Command::setApplication()

setApplication(Application $application = null) Sets the application instance for this command. Parameters Application $application An Application instance

Command::setAliases()

Command setAliases(string[] $aliases) Sets the aliases for the command. Parameters string[] $aliases An array of aliases for the command Return Value Command The current instance Exceptions InvalidArgumentException When an alias is invalid

Command::run()

int 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. Parameters InputInterface $input An InputInterface instance OutputInterface $output An OutputInterface instance Return Value int The command exit code Exceptions Exception See also setCode() execute()

Command::mergeApplicationDefinition()

mergeApplicationDefinition(bool $mergeArgs = true) Merges the application definition with the command definition. This method is not part of public API and should not be used directly. Parameters bool $mergeArgs Whether to merge or not the Application definition arguments to Command definition arguments

Command::isEnabled()

bool 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. Return Value bool

Command::ignoreValidationErrors()

ignoreValidationErrors() Ignores validation errors. This is mainly useful for the help command.

Command::getUsages()

array getUsages() Returns alternative usages of the command. Return Value array

Command::getSynopsis()

string getSynopsis(bool $short = false) Returns the synopsis for the command. Parameters bool $short Whether to show the short version of the synopsis (with options folded) or not Return Value string The synopsis

Command::getProcessedHelp()

string getProcessedHelp() Returns the processed help for the command replacing the %command.name% and %command.full_name% patterns with the real values dynamically. Return Value string The processed help for the command