private function ArgvInput::parseArgument in Zircon Profile 8.0
Same name and namespace in other branches
- 8 vendor/symfony/console/Input/ArgvInput.php \Symfony\Component\Console\Input\ArgvInput::parseArgument()
Parses an argument.
Parameters
string $token The current token:
Throws
\RuntimeException When too many arguments are given
1 call to ArgvInput::parseArgument()
- ArgvInput::parse in vendor/
symfony/ console/ Input/ ArgvInput.php - Processes command line arguments.
File
- vendor/
symfony/ console/ Input/ ArgvInput.php, line 161
Class
- ArgvInput
- ArgvInput represents an input coming from the CLI arguments.
Namespace
Symfony\Component\Console\InputCode
private function parseArgument($token) {
$c = count($this->arguments);
// if input is expecting another argument, add it
if ($this->definition
->hasArgument($c)) {
$arg = $this->definition
->getArgument($c);
$this->arguments[$arg
->getName()] = $arg
->isArray() ? array(
$token,
) : $token;
// if last argument isArray(), append token to last argument
}
elseif ($this->definition
->hasArgument($c - 1) && $this->definition
->getArgument($c - 1)
->isArray()) {
$arg = $this->definition
->getArgument($c - 1);
$this->arguments[$arg
->getName()][] = $token;
// unexpected argument
}
else {
throw new \RuntimeException('Too many arguments.');
}
}