Commands
in package
Core functionality for running, listing, etc commands.
Table of Contents
Properties
Methods
- __construct() : mixed
- Constructor
- discoverCommands() : void
- Discovers all commands in the framework and within user code, and collects instances of them to work with.
- getCommands() : array<string|int, mixed>
- Provide access to the list of commands.
- run() : int|void
- Runs a command given
- verifyCommand() : bool
- Verifies if the command being sought is found in the commands list.
- getCommandAlternatives() : array<string|int, mixed>
- Finds alternative of `$name` among collection of commands.
Properties
$commands
The found commands.
protected
array<string|int, mixed>
$commands
= []
$logger
Logger instance.
protected
Logger
$logger
Methods
__construct()
Constructor
public
__construct([Logger|null $logger = null ]) : mixed
Parameters
- $logger : Logger|null = null
discoverCommands()
Discovers all commands in the framework and within user code, and collects instances of them to work with.
public
discoverCommands() : void
getCommands()
Provide access to the list of commands.
public
getCommands() : array<string|int, mixed>
Return values
array<string|int, mixed>run()
Runs a command given
public
run(string $command, array<string|int, mixed> $params) : int|void
Parameters
- $command : string
- $params : array<string|int, mixed>
Return values
int|void —Exit code
verifyCommand()
Verifies if the command being sought is found in the commands list.
public
verifyCommand(string $command, array<string|int, mixed> $commands) : bool
Parameters
- $command : string
- $commands : array<string|int, mixed>
Return values
boolgetCommandAlternatives()
Finds alternative of `$name` among collection of commands.
protected
getCommandAlternatives(string $name, array<string|int, mixed> $collection) : array<string|int, mixed>
Parameters
- $name : string
- $collection : array<string|int, mixed>