Symfony2 API
Class

Symfony\Component\Console\Input\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

Methods

__construct(string $input, InputDefinition $definition = null)

Constructor.

string getFirstArgument()

Returns the first argument from the raw parameters (not parsed).

from ArgvInput
Boolean hasParameterOption(string|array $values)

Returns true if the raw parameters (not parsed) contain a value.

from ArgvInput
mixed getParameterOption(string|array $values, mixed $default = false)

Returns the value of a raw option (not parsed).

from ArgvInput
string __toString()

Returns a stringified representation of the args passed to the command

from ArgvInput

Details

at line 40
public __construct(string $input, InputDefinition $definition = null)

Constructor.

Parameters

string $input An array of parameters from the CLI (in the argv format)
InputDefinition $definition A InputDefinition instance

in ArgvInput at line 258
public string getFirstArgument()

Returns the first argument from the raw parameters (not parsed).

Return Value

string The value of the first argument or null otherwise

in ArgvInput at line 279
public Boolean hasParameterOption(string|array $values)

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.

Parameters

string|array $values The value(s) to look for in the raw parameters (can be an array)

Return Value

Boolean true if the value is contained in the raw parameters

in ArgvInput at line 303
public mixed getParameterOption(string|array $values, mixed $default = 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.

Parameters

string|array $values The value(s) to look for in the raw parameters (can be an array)
mixed $default The default value to return if no result is found

Return Value

mixed The option value

in ArgvInput at line 328
public string __toString()

Returns a stringified representation of the args passed to the command

Return Value

string