\Symfony\Component\Console\InputStreamableInputInterface

StreamableInputInterface is the interface implemented by all input classes that have an input stream.

Summary

Methods
Constants
getFirstArgument()
hasParameterOption()
getParameterOption()
bind()
validate()
getArguments()
getArgument()
setArgument()
hasArgument()
getOptions()
getOption()
setOption()
hasOption()
isInteractive()
setInteractive()
setStream()
getStream()
No constants found
No protected methods found
N/A
No private methods found
N/A

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

bind()

bind(\Symfony\Component\Console\Input\InputDefinition  $definition) 

Binds the current Input instance with the given arguments and options.

Parameters

\Symfony\Component\Console\Input\InputDefinition $definition

Throws

\Symfony\Component\Console\Exception\RuntimeException

validate()

validate() 

Validates the input.

Throws

\Symfony\Component\Console\Exception\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) : string|array<mixed,string>|null

Returns the argument value for a given argument name.

Parameters

string $name

The argument name

Throws

\Symfony\Component\Console\Exception\InvalidArgumentException

When argument given doesn't exist

Returns

string|array<mixed,string>|null —

The argument value

setArgument()

setArgument(string  $name, string|array<mixed,string>|null  $value) 

Sets an argument value by name.

Parameters

string $name

The argument name

string|array<mixed,string>|null $value

The argument value

Throws

\Symfony\Component\Console\Exception\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) : string|array<mixed,string>|boolean|null

Returns the option value for a given option name.

Parameters

string $name

The option name

Throws

\Symfony\Component\Console\Exception\InvalidArgumentException

When option given doesn't exist

Returns

string|array<mixed,string>|boolean|null —

The option value

setOption()

setOption(string  $name, string|array<mixed,string>|boolean|null  $value) 

Sets an option value by name.

Parameters

string $name

The option name

string|array<mixed,string>|boolean|null $value

The option value

Throws

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

setStream()

setStream(resource  $stream) 

Sets the input stream to read from when interacting with the user.

This is mainly useful for testing purpose.

Parameters

resource $stream

The input stream

getStream()

getStream() : resource|null

Returns the input stream.

Returns

resource|null