StringInput
class StringInput extends ArgvInput
StringInput represents an input provided as a string.
Usage:
$input = new StringInput('foo --bar="foobar"');
Constants
REGEX_STRING |
|
REGEX_QUOTED_STRING |
|
Properties
protected | $definition | from Input | |
protected | $stream | from Input | |
protected | $options | from Input | |
protected | $arguments | from Input | |
protected | $interactive | from Input |
Methods
No description
Binds the current Input instance with the given arguments and options.
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.