TYPO3
7.6
|
Public Member Functions | |
__construct (array $argv=null, 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 | |
setTokens (array $tokens) | |
parse () | |
Protected Member Functions inherited from Input | |
parse () | |
Private Member Functions | |
parseShortOption ($token) | |
parseShortOptionSet ($name) | |
parseLongOption ($token) | |
parseArgument ($token) | |
addShortOption ($shortcut, $value) | |
addLongOption ($name, $value) | |
Private Attributes | |
$tokens | |
$parsed | |
Additional Inherited Members | |
Protected Attributes inherited from Input | |
$definition | |
$options = array() | |
$arguments = array() | |
$interactive = true | |
ArgvInput represents an input coming from the CLI arguments.
Usage:
$input = new ArgvInput();
By default, the `$_SERVER['argv']` array is used for the input values.
This can be overridden by explicitly passing the input values in the constructor:
$input = new ArgvInput($_SERVER['argv']);
If you pass it yourself, don't forget that the first element of the array is the name of the running application.
When passing an argument to the constructor, be sure that it respects the same rules as the argv one. It's almost always better to use the StringInput
when you want to provide your own input.
Definition at line 41 of file ArgvInput.php.
__construct | ( | array | $argv = null , |
InputDefinition | $definition = null |
||
) |
Constructor.
array | $argv | An array of parameters from the CLI (in the argv format) |
InputDefinition | $definition | A InputDefinition instance |
Definition at line 54 of file ArgvInput.php.
References Input\$definition.
__toString | ( | ) |
Returns a stringified representation of the args passed to the command.
Definition at line 336 of file ArgvInput.php.
References ArgvInput\$tokens.
|
private |
Adds a long option value.
string | $name | The long option key |
mixed | $value | The value for the option |
\RuntimeException | When option given doesn't exist |
Definition at line 210 of file ArgvInput.php.
References elseif.
Referenced by ArgvInput\addShortOption(), ArgvInput\parseLongOption(), and ArgvInput\parseShortOptionSet().
|
private |
Adds a short option value.
string | $shortcut | The short option key |
mixed | $value | The value for the option |
\RuntimeException | When option given doesn't exist |
Definition at line 193 of file ArgvInput.php.
References ArgvInput\addLongOption().
Referenced by ArgvInput\parseShortOption().
getFirstArgument | ( | ) |
Returns the first argument from the raw parameters (not parsed).
Implements InputInterface.
Definition at line 262 of file ArgvInput.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.
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 |
Implements InputInterface.
Definition at line 309 of file ArgvInput.php.
References ArgvInput\$tokens.
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.
string | array | $values | The value(s) to look for in the raw parameters (can be an array) |
Implements InputInterface.
Definition at line 283 of file ArgvInput.php.
|
protected |
Processes command line arguments.
Definition at line 76 of file ArgvInput.php.
References ArgvInput\$tokens, elseif, ArgvInput\parseArgument(), ArgvInput\parseLongOption(), and ArgvInput\parseShortOption().
|
private |
Parses an argument.
string | $token | The current token |
\RuntimeException | When too many arguments are given |
Definition at line 165 of file ArgvInput.php.
References elseif.
Referenced by ArgvInput\parse().
|
private |
Parses a long option.
string | $token | The current token |
Definition at line 147 of file ArgvInput.php.
References ArgvInput\addLongOption().
Referenced by ArgvInput\parse().
|
private |
Parses a short option.
string | $token | The current token. |
Definition at line 100 of file ArgvInput.php.
References ArgvInput\addShortOption(), and ArgvInput\parseShortOptionSet().
Referenced by ArgvInput\parse().
|
private |
Parses a short option set.
string | $name | The current token |
\RuntimeException | When option given doesn't exist |
Definition at line 123 of file ArgvInput.php.
References ArgvInput\addLongOption().
Referenced by ArgvInput\parseShortOption().
|
protected |
Definition at line 68 of file ArgvInput.php.
References ArgvInput\$tokens.
Referenced by StringInput\__construct().
|
private |
Definition at line 44 of file ArgvInput.php.
|
private |
Definition at line 43 of file ArgvInput.php.
Referenced by ArgvInput\__toString(), ArgvInput\getParameterOption(), ArgvInput\parse(), ArgvInput\setTokens(), and StringInput\tokenize().