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

Breadcrumb

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

function ArgvInput::hasParameterOption

Overrides InputInterface::hasParameterOption

File

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

Class

ArgvInput
ArgvInput represents an input coming from the CLI arguments.

Namespace

Symfony\Component\Console\Input

Code

public function hasParameterOption(string|array $values, bool $onlyParams = false) : bool {
    $values = (array) $values;
    foreach ($this->tokens as $token) {
        if ($onlyParams && '--' === $token) {
            return false;
        }
        foreach ($values as $value) {
            // Options with values:
            //   For long options, test for '--option=' at beginning
            //   For short options, test for '-o' at beginning
            $leading = str_starts_with($value, '--') ? $value . '=' : $value;
            if ($token === $value || '' !== $leading && str_starts_with($token, $leading)) {
                return true;
            }
        }
    }
    return false;
}

API Navigation

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