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

Breadcrumb

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

function ArgvInput::parseShortOptionSet

Parses a short option set.

Throws

RuntimeException When option given doesn't exist

1 call to ArgvInput::parseShortOptionSet()
ArgvInput::parseShortOption in vendor/symfony/console/Input/ArgvInput.php
Parses a short option.

File

vendor/symfony/console/Input/ArgvInput.php, line 122

Class

ArgvInput
ArgvInput represents an input coming from the CLI arguments.

Namespace

Symfony\Component\Console\Input

Code

private function parseShortOptionSet(string $name) : void {
    $len = \strlen($name);
    for ($i = 0; $i < $len; ++$i) {
        if (!$this->definition
            ->hasShortcut($name[$i])) {
            $encoding = mb_detect_encoding($name, null, true);
            throw new RuntimeException(\sprintf('The "-%s" option does not exist.', false === $encoding ? $name[$i] : mb_substr($name, $i, 1, $encoding)));
        }
        $option = $this->definition
            ->getOptionForShortcut($name[$i]);
        if ($option->acceptValue()) {
            $this->addLongOption($option->getName(), $i === $len - 1 ? null : substr($name, $i + 1));
            break;
        }
        $this->addLongOption($option->getName(), null);
    }
}

API Navigation

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