Documentation

NonStringInput extends Input
in package

Input is the base class for all concrete Input classes.

Three concrete classes are provided by default:

  • ArgvInput: The input comes from the CLI arguments (argv)
  • StringInput: The input is provided as a string
  • ArrayInput: The input is provided as an array

Table of Contents

$arguments  : mixed
$definition  : mixed
$interactive  : mixed
$options  : mixed
$stream  : mixed
__construct()  : mixed
bind()  : mixed
Binds the current Input instance with the given arguments and options.
escapeToken()  : string
Escapes a token through escapeshellarg if it contains unsafe chars.
getArgument()  : string|array<string|int, string>|null
Returns the argument value for a given argument name.
getArguments()  : array<string|int, mixed>
Returns all the given arguments merged with the default values.
getFirstArgument()  : mixed
getOption()  : string|array<string|int, string>|bool|null
Returns the option value for a given option name.
getOptions()  : array<string|int, mixed>
Returns all the given options merged with the default values.
getParameterOption()  : mixed
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()  : mixed
isInteractive()  : bool
Is this input means interactive?
parse()  : mixed
Processes command line arguments.
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.

Properties

$arguments

protected mixed $arguments = []

$definition

protected mixed $definition

$interactive

protected mixed $interactive = true

$options

protected mixed $options = []

$stream

protected mixed $stream

Methods

bind()

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

public bind(InputDefinition $definition) : mixed
Parameters
$definition : InputDefinition
Return values
mixed

escapeToken()

Escapes a token through escapeshellarg if it contains unsafe chars.

public escapeToken(string $token) : string
Parameters
$token : string
Return values
string

getArgument()

Returns the argument value for a given argument name.

public getArgument(mixed $name) : string|array<string|int, string>|null
Parameters
$name : mixed

The argument name

Return values
string|array<string|int, string>|null

The argument value

getArguments()

Returns all the given arguments merged with the default values.

public getArguments() : array<string|int, mixed>
Return values
array<string|int, mixed>

getFirstArgument()

public getFirstArgument() : mixed
Return values
mixed

getOption()

Returns the option value for a given option name.

public getOption(mixed $name) : string|array<string|int, string>|bool|null
Parameters
$name : mixed

The option name

Return values
string|array<string|int, string>|bool|null

The option value

getOptions()

Returns all the given options merged with the default values.

public getOptions() : array<string|int, mixed>
Return values
array<string|int, mixed>

getParameterOption()

public getParameterOption(mixed $values[, mixed $default = false ][, mixed $onlyParams = false ]) : mixed
Parameters
$values : mixed
$default : mixed = false
$onlyParams : mixed = false
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(mixed $name) : bool
Parameters
$name : mixed

The InputArgument name or position

Return values
bool

true if the InputArgument object exists, false otherwise

hasOption()

Returns true if an InputOption object exists by name.

public hasOption(mixed $name) : bool
Parameters
$name : mixed

The InputOption name

Return values
bool

true if the InputOption object exists, false otherwise

hasParameterOption()

public hasParameterOption(mixed $values[, mixed $onlyParams = false ]) : mixed
Parameters
$values : mixed
$onlyParams : mixed = false
Return values
mixed

isInteractive()

Is this input means interactive?

public isInteractive() : bool
Return values
bool

parse()

Processes command line arguments.

public parse() : mixed
Return values
mixed

setArgument()

Sets an argument value by name.

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

The argument name

$value : mixed

The argument value

Return values
mixed

setInteractive()

Sets the input interactivity.

public setInteractive(mixed $interactive) : mixed
Parameters
$interactive : mixed

If the input should be interactive

Return values
mixed

setOption()

Sets an option value by name.

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

The option name

$value : mixed

The option value

Return values
mixed

setStream()

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

public setStream(mixed $stream) : mixed
Parameters
$stream : mixed

The input stream

Return values
mixed

validate()

Validates the input.

public validate() : mixed
Return values
mixed

Search results