SymfonyComponentConsoleInputArrayInput

ArrayInput represents an input provided as an array.

Usage:

$input = new ArrayInput(array('name' => 'foo', '--bar' => 'foobar'));
File
vendorSymfonyComponentConsoleInputArrayInput.php
Package
Default
Class hierarchy
SymfonyComponentConsoleInputArrayInput

Tags

author

Fabien Potencier fabien@symfony.com

api

Properties

$definition

$definition : 

Type

Inherited from
SymfonyComponentConsoleInputInput

Tags

None found

$options

$options : 

Type

Inherited from
SymfonyComponentConsoleInputInput

Tags

None found

$arguments

$arguments : 

Type

Inherited from
SymfonyComponentConsoleInputInput

Tags

None found

$interactive

$interactive : 

Type

Inherited from
SymfonyComponentConsoleInputInput

Tags

None found

$parameters

$parameters : 

Type

Tags

None found

Methods

__construct()

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

Constructor.

Parameters

array $parameters

An array of parameters

SymfonyComponentConsoleInputInputDefinition $definition

A InputDefinition instance

Tags

api

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

Inherited from
SymfonyComponentConsoleInputInput

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

Inherited from
SymfonyComponentConsoleInputInput

Tags

None found

isInteractive()

isInteractive() : Boolean

Checks if the input is interactive.

Returns

Boolean —

Returns true if the input is interactive

Inherited from
SymfonyComponentConsoleInputInput

Tags

None found

setInteractive()

setInteractive(Boolean  $interactive) 

Sets the input interactivity.

Parameters

Boolean $interactive

If the input should be interactive

Inherited from
SymfonyComponentConsoleInputInput

Tags

None found

getArguments()

getArguments() : array

Returns the argument values.

Returns

array —

An array of argument values

Inherited from
SymfonyComponentConsoleInputInput

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

Inherited from
SymfonyComponentConsoleInputInput

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

Inherited from
SymfonyComponentConsoleInputInput

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

Inherited from
SymfonyComponentConsoleInputInput

Tags

None found

getOptions()

getOptions() : array

Returns the options values.

Returns

array —

An array of option values

Inherited from
SymfonyComponentConsoleInputInput

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

Inherited from
SymfonyComponentConsoleInputInput

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

Inherited from
SymfonyComponentConsoleInputInput

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

Inherited from
SymfonyComponentConsoleInputInput

Tags

None found

getFirstArgument()

getFirstArgument() : string

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

Returns

string —

The value of the first argument or null otherwise

Tags

None found

hasParameterOption()

hasParameterOption(string|array  $values) : 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.

Parameters

string|array $values

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

Returns

Boolean —

true if the value is contained in the raw parameters

Tags

None found

getParameterOption()

getParameterOption(string|array  $values, mixed  $default = 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.

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

Returns

mixed —

The option value

Tags

None found

parse()

parse() 

Processes command line arguments.

Tags

None found

addShortOption()

addShortOption(string  $shortcut, mixed  $value) 

Adds a short option value.

Parameters

string $shortcut

The short option key

mixed $value

The value for the option

Throws

InvalidArgumentException

When option given doesn't exist

Tags

None found

addLongOption()

addLongOption(string  $name, mixed  $value) 

Adds a long option value.

Parameters

string $name

The long option key

mixed $value

The value for the option

Throws

InvalidArgumentException

When option given doesn't exist

InvalidArgumentException

When a required value is missing

Tags

None found

addArgument()

addArgument(string  $name, mixed  $value) 

Adds an argument value.

Parameters

string $name

The argument name

mixed $value

The value for the argument

Throws

InvalidArgumentException

When argument given doesn't exist

Tags

None found