function InputDefinition::getArgument
Returns an InputArgument by name or by position.
Throws
InvalidArgumentException When argument given doesn't exist
File
-
vendor/
symfony/ console/ Input/ InputDefinition.php, line 129
Class
- InputDefinition
- A InputDefinition represents a set of valid command line arguments and options.
Namespace
Symfony\Component\Console\InputCode
public function getArgument(string|int $name) : InputArgument {
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];
}