Returns the InputOption name given a shortcut.

@param string $shortcut The shortcut

@return string The InputOption name

@throws InvalidArgumentException When option given does not exist

@internal
351985
public function shortcutToName($shortcut)
    {
        if (!isset($this->shortcuts[$shortcut])) {
            throw new InvalidArgumentException(sprintf('The "-%s" option does not exist.', $shortcut));
        }

        return $this->shortcuts[$shortcut];
    }
681891
public function normalizeOptionName($key) {
    if ($key === null) { return null; }
    $map = $this->getNormAlizedOptiOnnameMap();
    return isset($map[$key]) ? $map[$key] : null;
  }
616424
protected function setShortcut()
    {
        if (strpos($this->input, '|') !== false) {
            list($this->shortcut, $this->input) = explode('|', $this->input);
        }

        return $this;
    }
213632
protected function getConsoleOptionInput($optionName)
    {
        $value = $this->consoleInput->getOption($optionName);

        if ($value) {
            $transformedCorrectly = true;

            try {
                $newValue = $this->transformValue($value, $optionName);
            } catch (LogicException $e) {
                $transformedCorrectly = false;

                // Present an error to indicate why the option wasn't accepted
                $this->consoleIo->block($e->getMessage(), 'ERROR', 'fg=white;bg=red;', ' ', true);
            }

            if ($transformedCorrectly) {
                return $newValue;
            }
        }

        $optionIsPromptable = in_array($optionName, $this->consolePrompts);

        if ( ! $optionIsPromptable) {
            return null;
        }

        $description = $this->getQuestionText($optionName);

        if ( ! $this->consoleInput->isInteractive()) {
            throw new \Exception(
                sprintf('Cannot prompt for %s, command is running in non-interactive mode', $optionName)
            );
        }

        /** @var QuestionHelper $question */
        $value = $this->consoleIo->ask(
            $description,
            null,
            function($value) use($optionName) {
                $noValue    = ($value === '' || $value === null);
                $isRequired = $this->promptConfig[$optionName]['required'];
                
                if ($noValue && $isRequired) {
                    throw new LogicException("A value is required.");
                }
                
                $value = $this->transformValue($value, $optionName);
                
                return $value;
            }
        );
        
        // If the transformer returned a null value and the input isn't required, resort to default value
        if ( ! $this->promptConfig[$optionName]['required'] && $value === null) {
            $value = $this->promptConfig[$optionName]['default'];
        }

        return $value;
    }
1025309
public function getOption($name = '')
    {
        if ('' === $name) {
            return $this->option;
        }

        return isset($this->option[$name]) ? $this->option[$name] : null;
    }
1275359
public function choiceLabel($choice)
    {
        if ($choice === null) {
            return null;
        }

        if (is_array($choice)) {
            if (isset($choice['label'])) {
                return $choice['label'];
            } elseif (isset($choice['value'])) {
                return $choice['value'];
            } else {
                throw new InvalidArgumentException(
                    'Choice structure must contain a "label" or "value".'
                );
            }
        }

        if (!is_string($choice)) {
            throw new InvalidArgumentException(
                'Choice identifier must be a string.'
            );
        }

        if ($this->hasChoice($choice)) {
            $choice = $this->choice($choice);
            return $choice['label'];
        } else {
            return $choice;
        }
    }
539995
public function serialize(Shortcut $shortcut, array $options = [])
    {
        return [
            'target' => $this->resourceNodeSerializer->serialize($shortcut->getTarget(), array_merge($options, [Options::SERIALIZE_MINIMAL])),
        ];
    }
128081
public function add_shortcut(string $id): ?string
  {
    if (
      ($bit = $this->pref->get_bit($id, false)) &&
      ($id_option = $this->from_path('shortcuts')) &&
      ($c = $this->pref->get_class_cfg())
    ){
      if ( $id_menu = $this->pref->get_by_option($id_option) ){
        $id_menu = $id_menu[$c['arch']['user_options']['id']];
      }
      else {
        $id_menu = $this->pref->add($id_option, [$c['arch']['user_options']['text'] => _('Shortcuts')]);
      }
      if (
        !empty($id_menu) &&
        ($arch = $c['arch']['user_options_bits'])
      ){
        if (
          ($bits = $this->pref->get_bits($id_menu, false, false)) &&
          ( \bbn\x::find($bits, [$arch['id_option'] => $bit[$arch['id_option']]]) !== false)
        ){
          return null;
        }
        return $this->pref->add_bit($id_menu, [
          $arch['id_option'] => $bit[$arch['id_option']],
          $arch['text'] => $bit[$arch['text']],
          $arch['cfg'] => $bit[$arch['cfg']],
          $arch['num'] => $this->pref->next_bit_num($id_menu) ?: 1
        ]);
      }
    }
    return null;
  }
741839
public function getOption($name)
    {
        $name = strtolower($name);
        if (array_key_exists($name, $this->options)) {
            return $this->options[$name];
        }
        return null;
    }
1056305
public function getOption($key)
    {
        if (!$this->hasOption($key)) {
            throw new InvalidException('Option '.$key.' does not exist');
        }

        return $this->_options[$key];
    }
771340
public function equals(InputOption $option)
    {
        return $option->getName() === $this->getName()
            && $option->getShortcut() === $this->getShortcut()
            && $option->getDefault() === $this->getDefault()
            && $option->isArray() === $this->isArray()
            && $option->isValueRequired() === $this->isValueRequired()
            && $option->isValueOptional() === $this->isValueOptional()
        ;
    }
1023807
protected function getCommandInput()
    {
        $appName = trim($this->argument('application-name'));
        $layoutFileName = Helpers::postFixWith(trim($this->option('layout-filename')) ?: 'layout-filename', '.blade.php');
        $layoutDirectory = trim($this->option('layout-directory'));
        $withoutValidation = $this->option('without-validation');
        $force = $this->option('force');

        return (object) compact('appName', 'layoutFileName', 'layoutDirectory', 'withoutValidation', 'force');
    }
1303705
protected function getOptionWordsWithValues()
    {
        $strings = array();

        foreach ($this->getAllOptions() as $option) {
            if ($option->isValueRequired()) {
                $strings[] = '--' . $option->getName();

                if ($option->getShortcut()) {
                    $strings[] = '-' . $option->getShortcut();
                }
            }
        }

        return $strings;
    }
839427
private function handleOptionName($name)
    {
        if (is_string($name)) {
            $name = explode('.', $name);
        }

        foreach ($this->optionNameHandlers as $handler) {
            $name = $handler($name);
        }

        return $name;
    }
16009
public Option getOptionWithShortForm( String shortForm ) throws InvalidOptionException
    {
        for (Option option : options)
        {
            if (shortForm.equals( option.getShortForm() )) return option;
        }

        throw new InvalidOptionException( shortForm );
    }
332147
public function setName($name) {
        if ($name !== null && ! $this->argumentsParser->isOptionName($name)) {
            throw new InvalidOptionNameException(s(
                'A option name must have this format: "--option", got: "%s"', $name
            ));
        }

        $this->name = $name;

        return $this;
    }
312497
protected function getOptionName($name)
    {

        $nameSpace = $this->getOptionNameSpace();
        if (empty($nameSpace))
            return $name;

        return $nameSpace.'.'.$name;
    }