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

Breadcrumb

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

function ArrayInput::getParameterOption

Overrides InputInterface::getParameterOption

File

vendor/symfony/console/Input/ArrayInput.php, line 69

Class

ArrayInput
ArrayInput represents an input provided as an array.

Namespace

Symfony\Component\Console\Input

Code

public function getParameterOption(string|array $values, string|bool|int|float|array|null $default = false, bool $onlyParams = false) : mixed {
    $values = (array) $values;
    foreach ($this->parameters as $k => $v) {
        if ($onlyParams && ('--' === $k || \is_int($k) && '--' === $v)) {
            return $default;
        }
        if (\is_int($k)) {
            if (\in_array($v, $values)) {
                return true;
            }
        }
        elseif (\in_array($k, $values)) {
            return $v;
        }
    }
    return $default;
}

API Navigation

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