Commands
in package
Core functionality for running, listing, etc commands.
Tags
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() : commands_list
- Provide access to the list of commands.
- run() : int
- Runs a command given
- verifyCommand() : bool
- Verifies if the command being sought is found in the commands list.
- getCommandAlternatives() : array<int, string>
- Finds alternative of `$name` among collection of commands.
Properties
$commands
The found commands.
protected
commands_list
$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() : commands_list
Return values
commands_listrun()
Runs a command given
public
run(string $command, array<int|string, string|null> $params) : int
Parameters
- $command : string
- $params : array<int|string, string|null>
Return values
int —Exit code
verifyCommand()
Verifies if the command being sought is found in the commands list.
public
verifyCommand(string $command, commands_list $commands) : bool
Parameters
- $command : string
- $commands : commands_list
Return values
boolgetCommandAlternatives()
Finds alternative of `$name` among collection of commands.
protected
getCommandAlternatives(string $name, commands_list $collection) : array<int, string>
Parameters
- $name : string
- $collection : commands_list