You are here

private function ArgvInput::parseShortOptionSet in Zircon Profile 8

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

Parses a short option set.

Parameters

string $name The current token:

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 119

Class

ArgvInput
ArgvInput represents an input coming from the CLI arguments.

Namespace

Symfony\Component\Console\Input

Code

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