Interface CommandInterface

Describe the interface between a command and the surrounding console libraries.

Namespace: Cake\Console

Constants summary

  • int
    CODE_ERROR
    1
  • int
    CODE_SUCCESS
    0

Method Summary

  • run() public

    Run the command.

  • setName() public

    Set the name this command uses in the collection.

Method Detail

run() public

run(array $argv, \Cake\Console\ConsoleIo $io)

Run the command.

Parameters

array $argv

Arguments from the CLI environment.

\Cake\Console\ConsoleIo $io

The console io

Returns

int|null

Exit code or null for success.

setName() public

setName(string $name)

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.

Parameters

string $name

The name the command uses in the collection.

Returns

$this

Throws

InvalidArgumentException

© 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.1/interface-Cake.Console.CommandInterface.html