Class Symfony\Component\Console\Input\ArgvInput

InheritanceSymfony\Component\Console\Input\ArgvInput » Symfony\Component\Console\Input\Input

ArgvInput represents an input coming from the CLI arguments.


$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.

See also:

Method Details

__construct() public method


public void __construct ( array $argv null, Symfony\Component\Console\Input\InputDefinition $definition null )
$argv array|null

An array of parameters from the CLI (in the argv format)

$definition Symfony\Component\Console\Input\InputDefinition|null

A InputDefinition instance

__toString() public method

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

public string __toString ( )
getFirstArgument() public method


public void getFirstArgument ( )
getParameterOption() public method


public void getParameterOption ( $values, $default false, $onlyParams false )
hasParameterOption() public method


public void hasParameterOption ( $values, $onlyParams false )
parse() protected method


protected void parse ( )
setTokens() protected method

protected void setTokens ( array $tokens )