You are here

public function Input::getOption in Zircon Profile 8

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

Returns the option value for a given option name.

Parameters

string $name The option name:

Return value

mixed The option value

Throws

\InvalidArgumentException When option given doesn't exist

Overrides InputInterface::getOption

File

vendor/symfony/console/Input/Input.php, line 184

Class

Input
Input is the base class for all concrete Input classes.

Namespace

Symfony\Component\Console\Input

Code

public function getOption($name) {
  if (!$this->definition
    ->hasOption($name)) {
    throw new \InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
  }
  return isset($this->options[$name]) ? $this->options[$name] : $this->definition
    ->getOption($name)
    ->getDefault();
}