You are here

private function ArgvInput::parseShortOption 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::parseShortOption()

Parses a short option.

Parameters

string $token The current token.:

1 call to ArgvInput::parseShortOption()
ArgvInput::parse in vendor/symfony/console/Input/ArgvInput.php
Processes command line arguments.

File

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

Class

ArgvInput
ArgvInput represents an input coming from the CLI arguments.

Namespace

Symfony\Component\Console\Input

Code

private function parseShortOption($token) {
  $name = substr($token, 1);
  if (strlen($name) > 1) {
    if ($this->definition
      ->hasShortcut($name[0]) && $this->definition
      ->getOptionForShortcut($name[0])
      ->acceptValue()) {

      // an option with a value (with no space)
      $this
        ->addShortOption($name[0], substr($name, 1));
    }
    else {
      $this
        ->parseShortOptionSet($name);
    }
  }
  else {
    $this
      ->addShortOption($name, null);
  }
}