ArrayInput
class ArrayInput extends Input
ArrayInput represents an input provided as an array.
Usage:
$input = new ArrayInput(array('name' => 'foo', '--bar' => 'foobar'));
Properties
protected | $definition | from Input | |
protected | $stream | from Input | |
protected | $options | from Input | |
protected | $arguments | from Input | |
protected | $interactive | from Input |
Methods
Binds the current Input instance with the given arguments and options.
Processes command line arguments.
Returns the argument value for a given argument name.
Returns true if an InputArgument object exists by name or position.
Returns the option value for a given option name.
Escapes a token through escapeshellarg if it contains unsafe chars.
Sets the input stream to read from when interacting with the user.
Returns the first argument from the raw parameters (not parsed).
Returns true if the raw parameters (not parsed) contain a value.
Returns the value of a raw option (not parsed).
Returns a stringified representation of the args passed to the command.
Details
bind(InputDefinition $definition)
Binds the current Input instance with the given arguments and options.
string|string[]|null
getArgument(string $name)
Returns the argument value for a given argument name.
bool
hasArgument(string|int $name)
Returns true if an InputArgument object exists by name or position.
string
escapeToken(string $token)
Escapes a token through escapeshellarg if it contains unsafe chars.
setStream(resource $stream)
Sets the input stream to read from when interacting with the user.
This is mainly useful for testing purpose.
bool
hasParameterOption(string|array $values, bool $onlyParams = false)
Returns true if the raw parameters (not parsed) contain a value.
This method is to be used to introspect the input parameters before they have been validated. It must be used carefully. Does not necessarily return the correct result for short options when multiple flags are combined in the same option.
mixed
getParameterOption(string|array $values, mixed $default = false, bool $onlyParams = false)
Returns the value of a raw option (not parsed).
This method is to be used to introspect the input parameters before they have been validated. It must be used carefully. Does not necessarily return the correct result for short options when multiple flags are combined in the same option.