@param Option|null $option
@param string $name
@return Option
@throws \Exception

Like _option but only for named flags
@throws \Exception
164172
private function _flag($option, $name)
    {
        if (isset($name) && is_numeric($name))
            throw new \Exception('Attempted to reference flag with a numeric index');
        return $this->_option($option, $name);
    }
1142540
public function option($type, $name = null, $alias = null) {
        $option = new Option($type, $name, $alias);
        $this->addOption($option);

        return $option;
    }
1072179
public static function getOption($name)
    {
        // Convert
        $constantName = self::getOptionName($name);

        if (!\defined($constantName)) {
            throw new LdapException(sprintf('Unknown option "%s".', $name));
        }

        return \constant($constantName);
    }
654643
public function setOption($name, $value = null)
    {
        // Set options
        if (is_array($name)) {
            foreach ($name as $k => $v) {
                $this->setOption($k, $v);
            }
            return $this;
        }

        if (method_exists($this, $method = 'set' . $name)) {
            return $this->$method($value);
        } else {
            $this->$name = $value;
            return $this;
        }
    }
103931
public function getOptionByName($name)
    {
        foreach ($this->options as $option) {
            if ($option->getName() == $name) {
                return $option;
            }
        }

        return false;
    }
54441
public function findOption($nameOrOption) {
        foreach ($this->getOptions() as $option) {
            if ($option->hasNameOrAlias($nameOrOption)) {
                return $option;
            }
        }

        throw new OptionNotFoundException(s(
            'Option "%s" does not exist.',
            $nameOrOption
        ));
    }
961554
public static function existsAlready($name, Exception $cause = null)
    {
        return new static(sprintf(
            'An option named "%s%s" exists already.',
            strlen($name) > 1 ? '--' : '-',
            $name
        ), 0, $cause);
    }
193014
public final function getOption($name)
    {
        return isset($this->_options[$name]) ? $this->_options[$name] : null;
    }
65455
public function getOption(string $name, $default = null)
    {
        $value = array_key_exists($name, $this->options) ? $this->options[$name] : $default;

        if ($value && ($value instanceof \Closure)) {
            $value = $value();
        }

        return $value;
    }
379957
public function option(string $name)
    {
        if (!array_key_exists($name, $this->options))
            throw new \InvalidArgumentException("Unknown option '{$name}'");
        return $this->options[$name];
    }
803518
public final <T> T getOption(String name)
    {
        if (arguments == null)
        {
            throw new IllegalStateException("setArgs not called");
        }
        Object value = options.get(name);
        if (value == null)
        {
            Option opt = map.get(name);
            if (opt == null)
            {
                throw new IllegalArgumentException("option "+name+" not found");
            }
            if (opt.defValue != null)
            {
                return (T) opt.defValue;
            }
            if (!opt.mandatory)
            {
                return null;
            }
            throw new IllegalArgumentException(name+" not found");
        }
        return (T) value;
    }
190983
public function getOption(string $name)
    {
        if (!$this->options->offsetExists($name)) {
            throw new Exception\InvalidArgumentException("Option '$name' does not exists'");
        }

        return $this->options[$name];
    }
720649
public function getOption($name, $default = null)
    {
        return array_key_exists($name, $this->raw['options'])
            ? $this->raw['options'][$name]
            : $default;
    }
404341
public static Option findOption(String name, Option[] options) {
        for (int i = 0; i < options.length; i++) {
            if (options[i].getName().equals(name)) {
                return options[i];
            }
        }
        return null;
    }
614440
public function getOption($name) {
		if (array_key_exists($name, $this->configuration)) {
			return $this->configuration[$name];
		}
		
		return null;
	}
151792
public function getOptionLong($name)
    {
        return isset($this->optionsLong[$name])
            ? $this->optionsLong[$name]
            : null
        ;
    }
325278
public function make($name, $options = [])
    {
        if (!$name || !$this->exists($name)) {
            return null;
        }

        return $name($options);
    }