TYPO3  7.6
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
ArrayInput Class Reference
Inheritance diagram for ArrayInput:
Input InputInterface

Public Member Functions

 __construct (array $parameters, InputDefinition $definition=null)
 
 getFirstArgument ()
 
 hasParameterOption ($values)
 
 getParameterOption ($values, $default=false)
 
 __toString ()
 
- Public Member Functions inherited from Input
 __construct (InputDefinition $definition=null)
 
 bind (InputDefinition $definition)
 
 validate ()
 
 isInteractive ()
 
 setInteractive ($interactive)
 
 getArguments ()
 
 getArgument ($name)
 
 setArgument ($name, $value)
 
 hasArgument ($name)
 
 getOptions ()
 
 getOption ($name)
 
 setOption ($name, $value)
 
 hasOption ($name)
 
 escapeToken ($token)
 

Protected Member Functions

 parse ()
 
- Protected Member Functions inherited from Input
 parse ()
 

Private Member Functions

 addShortOption ($shortcut, $value)
 
 addLongOption ($name, $value)
 
 addArgument ($name, $value)
 

Private Attributes

 $parameters
 

Additional Inherited Members

- Protected Attributes inherited from Input
 $definition
 
 $options = array()
 
 $arguments = array()
 
 $interactive = true
 

Detailed Description

ArrayInput represents an input provided as an array.

Usage:

$input = new ArrayInput(array('name' => 'foo', '--bar' => 'foobar'));
Author
Fabien Potencier fabie.nosp@m.n@sy.nosp@m.mfony.nosp@m..com

Definition at line 25 of file ArrayInput.php.

Constructor & Destructor Documentation

__construct ( array  $parameters,
InputDefinition  $definition = null 
)

Constructor.

Parameters
array$parametersAn array of parameters
InputDefinition$definitionA InputDefinition instance

Definition at line 37 of file ArrayInput.php.

References Input\$definition, and ArrayInput\$parameters.

Member Function Documentation

__toString ( )

Returns a stringified representation of the args passed to the command.

Returns
string

Definition at line 120 of file ArrayInput.php.

References Input\escapeToken().

addArgument (   $name,
  $value 
)
private

Adds an argument value.

Parameters
string$nameThe argument name
mixed$valueThe value for the argument
Exceptions
\InvalidArgumentExceptionWhen argument given doesn't exist

Definition at line 203 of file ArrayInput.php.

Referenced by ArrayInput\parse().

addLongOption (   $name,
  $value 
)
private

Adds a long option value.

Parameters
string$nameThe long option key
mixed$valueThe value for the option
Exceptions
\InvalidArgumentExceptionWhen option given doesn't exist
\InvalidArgumentExceptionWhen a required value is missing

Definition at line 176 of file ArrayInput.php.

Referenced by ArrayInput\addShortOption(), and ArrayInput\parse().

addShortOption (   $shortcut,
  $value 
)
private

Adds a short option value.

Parameters
string$shortcutThe short option key
mixed$valueThe value for the option
Exceptions
\InvalidArgumentExceptionWhen option given doesn't exist

Definition at line 158 of file ArrayInput.php.

References ArrayInput\addLongOption().

Referenced by ArrayInput\parse().

getFirstArgument ( )

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

Returns
string The value of the first argument or null otherwise

Implements InputInterface.

Definition at line 49 of file ArrayInput.php.

getParameterOption (   $values,
  $default = false 
)

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$valuesThe value(s) to look for in the raw parameters (can be an array)
mixed$defaultThe default value to return if no result is found
Returns
mixed The option value

Implements InputInterface.

Definition at line 98 of file ArrayInput.php.

References elseif.

hasParameterOption (   $values)

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$valuesThe values to look for in the raw parameters (can be an array)
Returns
bool true if the value is contained in the raw parameters

Implements InputInterface.

Definition at line 70 of file ArrayInput.php.

parse ( )
protected

Processes command line arguments.

Definition at line 137 of file ArrayInput.php.

References ArrayInput\addArgument(), ArrayInput\addLongOption(), ArrayInput\addShortOption(), and elseif.

Member Data Documentation

$parameters
private

Definition at line 27 of file ArrayInput.php.

Referenced by ArrayInput\__construct().