You are here

public function ArgvInput::getParameterOption 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::getParameterOption()

Returns the value of a raw option (not parsed).

This method is to be used to introspect the input parameters before they have been validated. It must be used carefully.

Parameters

string|array $values The value(s) to look for in the raw parameters (can be an array):

mixed $default The default value to return if no result is found:

Return value

mixed The option value

Overrides InputInterface::getParameterOption

File

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

Class

ArgvInput
ArgvInput represents an input coming from the CLI arguments.

Namespace

Symfony\Component\Console\Input

Code

public function getParameterOption($values, $default = false) {
  $values = (array) $values;
  $tokens = $this->tokens;
  while (0 < count($tokens)) {
    $token = array_shift($tokens);
    foreach ($values as $value) {
      if ($token === $value || 0 === strpos($token, $value . '=')) {
        if (false !== ($pos = strpos($token, '='))) {
          return substr($token, $pos + 1);
        }
        return array_shift($tokens);
      }
    }
  }
  return $default;
}