class Input

Input.

Constants

NAMED_ARGUMENT_REGEX

Regex that matches named arguments.

Properties

protected ReaderInterface $reader Reader.
protected array $arguments Arguments.

Methods

__construct(ReaderInterface $reader, array|null $arguments = null)

Constructor.

array
parseArguments(array $arguments)

Parses parameters.

string
read()

Reads and returns user input.

array
getArguments()

Returns all the arguments passed to the script.

mixed
getArgument(int|string $name, mixed $default = null)

Returns the argument associated with the given name.

Details

at line 51
__construct(ReaderInterface $reader, array|null $arguments = null)

Constructor.

Parameters

ReaderInterface $reader Reader instance
array|null $arguments Array of arguments passed to script

at line 64
protected array parseArguments(array $arguments)

Parses parameters.

Parameters

array $arguments Arguments

Return Value

array

at line 92
string read()

Reads and returns user input.

Return Value

string

at line 102
array getArguments()

Returns all the arguments passed to the script.

Return Value

array

at line 114
mixed getArgument(int|string $name, mixed $default = null)

Returns the argument associated with the given name.

Parameters

int|string $name Parameter number or name
mixed $default Default value

Return Value

mixed