Methods

getFirstArgument()

getFirstArgument() : string|null

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

Returns

string|null —

The value of the first argument or null otherwise

hasParameterOption()

hasParameterOption(string|array  $values, boolean  $onlyParams = false) : boolean

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.

Parameters

string|array $values

The values to look for in the raw parameters (can be an array)

boolean $onlyParams

Only check real parameters, skip those following an end of options (--) signal

Returns

boolean —

true if the value is contained in the raw parameters

getParameterOption()

getParameterOption(string|array  $values, mixed  $default = false, boolean  $onlyParams = false) : mixed

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.

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

boolean $onlyParams

Only check real parameters, skip those following an end of options (--) signal

Returns

mixed —

The option value

validate()

validate() 

Validates the input.

Throws

\RuntimeException

When not enough arguments are given

getArguments()

getArguments() : array

Returns all the given arguments merged with the default values.

Returns

array

getArgument()

getArgument(string  $name) : mixed

Returns the argument value for a given argument name.

Parameters

string $name

The argument name

Throws

\InvalidArgumentException

When argument given doesn't exist

Returns

mixed —

The argument value

setArgument()

setArgument(string  $name, string  $value) 

Sets an argument value by name.

Parameters

string $name

The argument name

string $value

The argument value

Throws

\InvalidArgumentException

When argument given doesn't exist

hasArgument()

hasArgument(string|integer  $name) : boolean

Returns true if an InputArgument object exists by name or position.

Parameters

string|integer $name

The InputArgument name or position

Returns

boolean —

true if the InputArgument object exists, false otherwise

getOptions()

getOptions() : array

Returns all the given options merged with the default values.

Returns

array

getOption()

getOption(string  $name) : mixed

Returns the option value for a given option name.

Parameters

string $name

The option name

Throws

\InvalidArgumentException

When option given doesn't exist

Returns

mixed —

The option value

setOption()

setOption(string  $name, string|boolean  $value) 

Sets an option value by name.

Parameters

string $name

The option name

string|boolean $value

The option value

Throws

\InvalidArgumentException

When option given doesn't exist

hasOption()

hasOption(string  $name) : boolean

Returns true if an InputOption object exists by name.

Parameters

string $name

The InputOption name

Returns

boolean —

true if the InputOption object exists, false otherwise

isInteractive()

isInteractive() : boolean

Is this input means interactive?

Returns

boolean

setInteractive()

setInteractive(boolean  $interactive) 

Sets the input interactivity.

Parameters

boolean $interactive

If the input should be interactive