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\InputCode
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;
}