You are here

public function InputDefinition::getArgument in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/console/Input/InputDefinition.php \Symfony\Component\Console\Input\InputDefinition::getArgument()

Returns an InputArgument by name or by position.

Parameters

string|int $name The InputArgument name or position:

Return value

InputArgument An InputArgument object

Throws

\InvalidArgumentException When argument given doesn't exist

File

vendor/symfony/console/Input/InputDefinition.php, line 141

Class

InputDefinition
A InputDefinition represents a set of valid command line arguments and options.

Namespace

Symfony\Component\Console\Input

Code

public function getArgument($name) {
  if (!$this
    ->hasArgument($name)) {
    throw new \InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  }
  $arguments = is_int($name) ? array_values($this->arguments) : $this->arguments;
  return $arguments[$name];
}