Reactor
class Reactor
Reactor.
Traits
Properties
protected Input | $input | Input. | |
protected Output | $output | Output. | |
protected Container | $container | Container. | |
protected Dispatcher | $dispatcher | Dispatcher. | |
protected array | $commands | Commands. | |
protected array | $options | Options. | |
protected string | $logo | Logo. |
Methods
Returns the string that resembles the provided string the most.
Constructor.
Registers a command.
Register a global reactor option.
Sets the reactor logo.
Handles global reactor options.
Draws information table.
Returns an array of option information.
Displays global reactor options of there are any.
Displays basic reactor information.
Instantiates command without calling the constructor.
Returns an array of command information.
Lists available commands if there are any.
Displays reactor info and lists all available commands.
Converst the argument and options arrays to table rows.
Displays information about the chosen command.
Returns true if the command exists and false if not.
Displays error message for unknown commands.
Returns the names of the global options.
Dispatches a command.
Run the reactor.
Details
in SuggestionTrait at line 27
protected string|null
suggest(string $string, array $alternatives)
Returns the string that resembles the provided string the most.
NULL is returned if no string with a similarity of 66% or more is found.
at line 95
__construct(Input $input, Output $output, Container|null $container = null, Dispatcher|null $dispatcher = null)
Constructor.
at line 112
registerCommand(string $command, string $class)
Registers a command.
at line 125
registerGlobalOption(string $name, string $description, Closure $handler, string $group = 'default')
Register a global reactor option.
at line 135
setLogo(string $logo)
Sets the reactor logo.
at line 145
handleGlobalOptions(string $group = 'default')
Handles global reactor options.
at line 170
protected
drawTable(string $heading, array $headers, array $rows)
Draws information table.
at line 193
protected array
getOptions()
Returns an array of option information.
at line 213
protected
listOptions()
Displays global reactor options of there are any.
at line 223
protected
displayReactorInfo()
Displays basic reactor information.
at line 251
protected CommandInterface
instantiateCommandWithoutConstructor(string $class)
Instantiates command without calling the constructor.
at line 261
protected array
getCommands()
Returns an array of command information.
at line 280
protected
listCommands()
Lists available commands if there are any.
at line 292
protected int
displayReactorInfoAndCommandList()
Displays reactor info and lists all available commands.
at line 307
protected array
convertArgumentsAndOptionsArrayToRows(array $input)
Converst the argument and options arrays to table rows.
at line 325
protected int
displayCommandHelp(string $command)
Displays information about the chosen command.
at line 362
protected bool
commandExists(string $command)
Returns true if the command exists and false if not.
at line 373
protected int
unknownCommand(string $command)
Displays error message for unknown commands.
at line 394
protected array
getGlobalOptionNames()
Returns the names of the global options.
at line 412
protected int
dispatch(string $command)
Dispatches a command.
at line 435
int
run()
Run the reactor.