Input
About 1 min
Input
Console input parser and execution context holder.
class InputParses CLI argv tokens into module/command selection, global options, command-specific options, and positional arguments used during command execution.
Properties
executable
Executable basename used in usage/help messages.
private string $executableargv
private array $argvargs
private array $argsglobalOptions
private array $globalOptionsoptions
private array $optionsmodule
public string $modulecommand
public string $commandcommandObject
public Command $commandObjectMethods
initialise
Initialises the input object with the command line arguments.
public initialise(array $argv, array $moduleNames): boolParameters
| Parameter | Type | Description |
|---|---|---|
$argv | array | |
$moduleNames | array |
run
Binds a command definition and parses argv into option/argument values.
public run(Command $command, array $moduleOptions): voidParameters
| Parameter | Type | Description |
|---|---|---|
$command | Command | command definition to parse against |
$moduleOptions | array | options defined at the module level |
getExecutable
public getExecutable(): stringgetGlobalOption
public getGlobalOption(string $name): mixedParameters
| Parameter | Type | Description |
|---|---|---|
$name | string |
getModule
public getModule(): ?stringgetCommandObject
public getCommandObject(): ?CommandgetCommand
Gets the command that was used on the command line if it exists.
public getCommand(): ?stringgetArgument
public getArgument(string $name): ?stringParameters
| Parameter | Type | Description |
|---|---|---|
$name | string |
getArguments
Gets all the arguments that were passed to the command.
public getArguments(): voidgetOption
public getOption(string $name, ?string $default): mixedParameters
| Parameter | Type | Description |
|---|---|---|
$name | string | |
$default | string |
getOptions
Gets the options that were set on the command line.
public getOptions(): voidsetOption
public setOption(string $name, mixed $value): voidParameters
| Parameter | Type | Description |
|---|---|---|
$name | string | |
$value | mixed |
getArgv
Gets the options that were used on the command line.
public getArgv(): voidparseOption
Parses a command line option and adds it to the options array.
private parseOption(array $argv, array $optionsDefinition, array $options): boolParameters
| Parameter | Type | Description |
|---|---|---|
$argv | array | |
$optionsDefinition | array | |
$options | array |
Generated by Hazaar API Doc Generator on Tue, 21 Apr 2026 04:00:25 +0000