Documentation

StreamableInputInterface extends InputInterface

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

Tags
author

Robin Chalas robin.chalas@gmail.com

Table of Contents

bind()  : mixed
Binds the current Input instance with the given arguments and options.
getArgument()  : mixed
Returns the argument value for a given argument name.
getArguments()  : array<string|int, string|bool|int|float|array|null>
Returns all the given arguments merged with the default values.
getFirstArgument()  : string|null
Returns the first argument from the raw parameters (not parsed).
getOption()  : mixed
Returns the option value for a given option name.
getOptions()  : array<string|int, string|bool|int|float|array|null>
Returns all the given options merged with the default values.
getParameterOption()  : mixed
Returns the value of a raw option (not parsed).
getStream()  : resource|null
Returns the input stream.
hasArgument()  : bool
Returns true if an InputArgument object exists by name or position.
hasOption()  : bool
Returns true if an InputOption object exists by name.
hasParameterOption()  : bool
Returns true if the raw parameters (not parsed) contain a value.
isInteractive()  : bool
Is this input means interactive?
setArgument()  : mixed
Sets an argument value by name.
setInteractive()  : mixed
Sets the input interactivity.
setOption()  : mixed
Sets an option value by name.
setStream()  : mixed
Sets the input stream to read from when interacting with the user.
validate()  : mixed
Validates the input.

Methods

getArgument()

Returns the argument value for a given argument name.

public getArgument(string $name) : mixed
Parameters
$name : string
Tags
throws
InvalidArgumentException

When argument given doesn't exist

Return values
mixed

getArguments()

Returns all the given arguments merged with the default values.

public getArguments() : array<string|int, string|bool|int|float|array|null>
Return values
array<string|int, string|bool|int|float|array|null>

getFirstArgument()

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

public getFirstArgument() : string|null
Return values
string|null

getOption()

Returns the option value for a given option name.

public getOption(string $name) : mixed
Parameters
$name : string
Tags
throws
InvalidArgumentException

When option given doesn't exist

Return values
mixed

getOptions()

Returns all the given options merged with the default values.

public getOptions() : array<string|int, string|bool|int|float|array|null>
Return values
array<string|int, string|bool|int|float|array|null>

getParameterOption()

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

public getParameterOption(string|array<string|int, mixed> $values[, string|bool|int|float|array<string|int, mixed>|null $default = false ][, bool $onlyParams = false ]) : mixed

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
$values : string|array<string|int, mixed>

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

$default : string|bool|int|float|array<string|int, mixed>|null = false

The default value to return if no result is found

$onlyParams : bool = false

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

Return values
mixed

getStream()

Returns the input stream.

public getStream() : resource|null
Return values
resource|null

hasArgument()

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

public hasArgument(string $name) : bool
Parameters
$name : string
Return values
bool

hasOption()

Returns true if an InputOption object exists by name.

public hasOption(string $name) : bool
Parameters
$name : string
Return values
bool

hasParameterOption()

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

public hasParameterOption(string|array<string|int, mixed> $values[, bool $onlyParams = false ]) : bool

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
$values : string|array<string|int, mixed>

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

$onlyParams : bool = false

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

Return values
bool

isInteractive()

Is this input means interactive?

public isInteractive() : bool
Return values
bool

setArgument()

Sets an argument value by name.

public setArgument(string $name, mixed $value) : mixed
Parameters
$name : string
$value : mixed

The argument value

Tags
throws
InvalidArgumentException

When argument given doesn't exist

Return values
mixed

setInteractive()

Sets the input interactivity.

public setInteractive(bool $interactive) : mixed
Parameters
$interactive : bool
Return values
mixed

setOption()

Sets an option value by name.

public setOption(string $name, mixed $value) : mixed
Parameters
$name : string
$value : mixed

The option value

Tags
throws
InvalidArgumentException

When option given doesn't exist

Return values
mixed

setStream()

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

public setStream(resource $stream) : mixed

This is mainly useful for testing purpose.

Parameters
$stream : resource

The input stream

Return values
mixed

validate()

Validates the input.

public validate() : mixed
Tags
throws
RuntimeException

When not enough arguments are given

Return values
mixed

Search results