Class HelpCommand
Print out command list
Property Summary
Method Summary
- 
          abort() publicHalt the the current process with a StopException. 
- 
          asText() protectedOutput text. 
- 
          asXml() protectedOutput as XML 
- 
          buildOptionParser() protectedGets the option parser instance and configures it. 
- 
          defaultName() public staticGet the command name. 
- 
          displayHelp() protectedOutput help content 
- 
          execute() publicMain function Prints out the list of commands. 
- 
          executeCommand() publicExecute another command with the provided set of arguments. 
- 
          getName() publicGet the command name. 
- 
          getOptionParser() publicGet the option parser. 
- 
          getRootName() publicGet the root command name. 
- 
          getShortestName() protected
- 
          initialize() publicHook method invoked by CakePHP when a command is about to be executed. 
- 
          outputPaths() protectedOutput relevant paths if defined 
- 
          run() publicRun the command. 
- 
          setCommandCollection() publicSet the command collection being used. 
- 
          setName() publicSet the name this command uses in the collection. 
- 
          setOutputLevel() protectedSet the output level based on the Arguments. 
Method Detail
abort() ¶ public
abort(int $code = self::CODE_ERROR): voidHalt the the current process with a StopException.
Parameters
- 
                int$code optional
- The exit code to use. 
Returns
voidThrows
Cake\Console\Exception\StopExceptionasText() ¶ protected
asText(Cake\Console\ConsoleIo $io, iterable $commands): voidOutput text.
Parameters
- 
                Cake\Console\ConsoleIo$io
- The console io 
- 
                iterable$commands
- The command collection to output. 
Returns
voidasXml() ¶ protected
asXml(Cake\Console\ConsoleIo $io, iterable $commands): voidOutput as XML
Parameters
- 
                Cake\Console\ConsoleIo$io
- The console io 
- 
                iterable$commands
- The command collection to output 
Returns
voidbuildOptionParser() ¶ protected
buildOptionParser(Cake\Console\ConsoleOptionParser $parser): Cake\Console\ConsoleOptionParserGets the option parser instance and configures it.
Parameters
- 
                Cake\Console\ConsoleOptionParser$parser
- The parser to build 
Returns
Cake\Console\ConsoleOptionParserdefaultName() ¶ public static
defaultName(): stringGet the command name.
Returns the command name based on class name.
For e.g. for a command with class name UpdateTableCommand the default
name returned would be 'update_table'.
Returns
stringdisplayHelp() ¶ protected
displayHelp(Cake\Console\ConsoleOptionParser $parser, Cake\Console\Arguments $args, Cake\Console\ConsoleIo $io): voidOutput help content
Parameters
- 
                Cake\Console\ConsoleOptionParser$parser
- The option parser. 
- 
                Cake\Console\Arguments$args
- The command arguments. 
- 
                Cake\Console\ConsoleIo$io
- The console io 
Returns
voidexecute() ¶ public
execute(Cake\Console\Arguments $args, Cake\Console\ConsoleIo $io): intMain function Prints out the list of commands.
Parameters
- 
                Cake\Console\Arguments$args
- The command arguments. 
- 
                Cake\Console\ConsoleIo$io
- The console io 
Returns
intexecuteCommand() ¶ public
executeCommand(string|Cake\Console\CommandInterface $command, array $args = [], Cake\Console\ConsoleIo $io = null): int|nullExecute another command with the provided set of arguments.
If you are using a string command name, that command's dependencies will not be resolved with the application container. Instead you will need to pass the command as an object with all of its dependencies.
Parameters
- 
                string|Cake\Console\CommandInterface$command
- The command class name or command instance. 
- 
                array$args optional
- The arguments to invoke the command with. 
- 
                Cake\Console\ConsoleIo$io optional
- The ConsoleIo instance to use for the executed command. 
Returns
int|nullThe exit code or null for success of the command.
getOptionParser() ¶ public
getOptionParser(): Cake\Console\ConsoleOptionParserGet the option parser.
You can override buildOptionParser() to define your options & arguments.
Returns
Cake\Console\ConsoleOptionParserThrows
RuntimeExceptionWhen the parser is invalid
getShortestName() ¶ protected
getShortestName(string[] $names): stringParameters
- 
                string[]$names
- Names 
Returns
stringinitialize() ¶ public
initialize(): voidHook method invoked by CakePHP when a command is about to be executed.
Override this method and implement expensive/important setup steps that should not run on every command run. This method will be called before the options and arguments are validated and processed.
Returns
voidoutputPaths() ¶ protected
outputPaths(Cake\Console\ConsoleIo $io): voidOutput relevant paths if defined
Parameters
- 
                Cake\Console\ConsoleIo$io
- IO object. 
Returns
voidrun() ¶ public
run(array $argv, Cake\Console\ConsoleIo $io): int|nullRun the command.
Parameters
- 
                array$argv
- 
                Cake\Console\ConsoleIo$io
Returns
int|nullsetCommandCollection() ¶ public
setCommandCollection(Cake\Console\CommandCollection $commands): voidSet the command collection being used.
Parameters
- 
                Cake\Console\CommandCollection$commands
Returns
voidsetName() ¶ public
setName(string $name): $thisSet the name this command uses in the collection.
Generally invoked by the CommandCollection when the command is added. Required to have at least one space in the name so that the root command can be calculated.
Parameters
- 
                string$name
Returns
$thissetOutputLevel() ¶ protected
setOutputLevel(Cake\Console\Arguments $args, Cake\Console\ConsoleIo $io): voidSet the output level based on the Arguments.
Parameters
- 
                Cake\Console\Arguments$args
- The command arguments. 
- 
                Cake\Console\ConsoleIo$io
- The console io 
Returns
void