Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Input.php

function Input::getOption

Overrides InputInterface::getOption

File

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

Class

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

Namespace

Symfony\Component\Console\Input

Code

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

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal