SymfonyComponentConsoleInputInput

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
abstract
File
vendorSymfonyComponentConsoleInputInput.php
Package
Default
Class hierarchy
SymfonyComponentConsoleInputInput
Implements
SymfonyComponentConsoleInputInputInterface

Tags

author

Fabien Potencier fabien@symfony.com

Properties

$definition

$definition : 

Type

Tags

None found

$options

$options : 

Type

Tags

None found

$arguments

$arguments : 

Type

Tags

None found

$interactive

$interactive : 

Type

Tags

None found

Methods

__construct()

__construct(\Symfony\Component\Console\Input\InputDefinition  $definition = null) 

Constructor.

Parameters

SymfonyComponentConsoleInputInputDefinition $definition

A InputDefinition instance

Tags

None found

bind()

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

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

Parameters

SymfonyComponentConsoleInputInputDefinition $definition

A InputDefinition instance

Tags

None found

validate()

validate() 

Validates the input.

Throws an exception when not enough arguments are given.

Throws

RuntimeException

When not enough arguments are given

Tags

None found

isInteractive()

isInteractive() : Boolean

Checks if the input is interactive.

Returns

Boolean —

Returns true if the input is interactive

Tags

None found

setInteractive()

setInteractive(Boolean  $interactive) 

Sets the input interactivity.

Parameters

Boolean $interactive

If the input should be interactive

Tags

None found

getArguments()

getArguments() : array

Returns the argument values.

Returns

array —

An array of argument values

Tags

None found

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

Tags

None found

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

Tags

None found

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

Tags

None found

getOptions()

getOptions() : array

Returns the options values.

Returns

array —

An array of option values

Tags

None found

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

Tags

None found

setOption()

setOption(string  $name, string  $value) 

Sets an option value by name.

Parameters

string $name

The option name

string $value

The option value

Throws

InvalidArgumentException

When option given doesn't exist

Tags

None found

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

Tags

None found

parse()

parse() 

Processes command line arguments.

abstract

Tags

None found