CommandInterface
in
Describe the interface between a command and the surrounding console libraries.
Table of Contents
Constants
- CODE_ERROR = 1
- Default error code
- CODE_SUCCESS = 0
- Default success code
Methods
- run() : int|null
- Run the command.
- setName() : $this
- Set the name this command uses in the collection.
Constants
CODE_ERROR
Default error code
public
int
CODE_ERROR
= 1
CODE_SUCCESS
Default success code
public
int
CODE_SUCCESS
= 0
Methods
run()
Run the command.
public
run(array<string|int, mixed> $argv, ConsoleIo $io) : int|null
Parameters
- $argv : array<string|int, mixed>
-
Arguments from the CLI environment.
- $io : ConsoleIo
-
The console io
Return values
int|null —Exit code or null for success.
setName()
Set the name this command uses in the collection.
public
setName(string $name) : $this
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
- $name : string
-
The name the command uses in the collection.