Print out command list
int 1
Default error code
int 0
Default success code
Halt the the current process with a StopException.
Output text.
Output as XML
Gets the option parser instance and configures it.
Get the command name.
Output help content
Main function Prints out the list of commands.
Execute another command with the provided set of arguments.
Get the command description.
Get the command name.
Get the option parser.
Get the root command name.
Hook method invoked by CakePHP when a command is about to be executed.
Output relevant paths if defined
Run the command.
Set the command collection being used.
Set the name this command uses in the collection.
Set the output level based on the Arguments.
abort(int $code = self::CODE_ERROR): void
Halt the the current process with a StopException.
int $code optional The exit code to use.
voidCake\Console\Exception\StopExceptionasText(Cake\Console\ConsoleIo $io, iterable $commands): void
Output text.
Cake\Console\ConsoleIo $io The console io
iterable $commands The command collection to output.
voidasXml(Cake\Console\ConsoleIo $io, iterable $commands): void
Output as XML
Cake\Console\ConsoleIo $io The console io
iterable $commands The command collection to output
voidbuildOptionParser(Cake\Console\ConsoleOptionParser $parser): Cake\Console\ConsoleOptionParser
Gets the option parser instance and configures it.
Cake\Console\ConsoleOptionParser $parser The parser to build
Cake\Console\ConsoleOptionParserdefaultName(): string
Get 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'.
stringdisplayHelp(Cake\Console\ConsoleOptionParser $parser, Cake\Console\Arguments $args, Cake\Console\ConsoleIo $io): void
Output help content
Cake\Console\ConsoleOptionParser $parser The option parser.
Cake\Console\Arguments $args The command arguments.
Cake\Console\ConsoleIo $io The console io
voidexecute(Cake\Console\Arguments $args, Cake\Console\ConsoleIo $io): int
Main function Prints out the list of commands.
Cake\Console\Arguments $args The command arguments.
Cake\Console\ConsoleIo $io The console io
intexecuteCommand(Cake\Console\CommandInterface|string $command, array $args = [], Cake\Console\ConsoleIo|null $io = null): int|null
Execute 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.
Cake\Console\CommandInterface|string $command The command class name or command instance.
array $args optional The arguments to invoke the command with.
Cake\Console\ConsoleIo|null $io optional The ConsoleIo instance to use for the executed command.
int|nullgetDescription(): string
Get the command description.
stringgetName(): string
Get the command name.
stringgetOptionParser(): Cake\Console\ConsoleOptionParser
Get the option parser.
You can override buildOptionParser() to define your options & arguments.
Cake\Console\ConsoleOptionParserRuntimeExceptiongetRootName(): string
Get the root command name.
stringgetShortestName(array<string> $names): string
array<string> $names Names
stringinitialize(): void
Hook 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.
voidoutputPaths(Cake\Console\ConsoleIo $io): void
Output relevant paths if defined
Cake\Console\ConsoleIo $io IO object.
voidrun(array $argv, Cake\Console\ConsoleIo $io): int|null
Run the command.
array $argv Cake\Console\ConsoleIo $io int|nullsetCommandCollection(Cake\Console\CommandCollection $commands): void
Set the command collection being used.
Cake\Console\CommandCollection $commands voidsetName(string $name): $this
Set 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.
string $name $thissetOutputLevel(Cake\Console\Arguments $args, Cake\Console\ConsoleIo $io): void
Set the output level based on the Arguments.
Cake\Console\Arguments $args The command arguments.
Cake\Console\ConsoleIo $io The console io
voidThe command collection to get help on.
Cake\Console\CommandCollectionThe name of this command.
string
© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/4.4/class-Cake.Console.Command.HelpCommand.html