You are here

public function InputBag::all in Drupal 9

Returns the parameters.

Parameters

string|null $key: The name of the parameter to return or null to get them all.

Return value

array An array of parameters.

File

core/lib/Drupal/Core/Http/InputBag.php, line 24

Class

InputBag
Forward compatibility class for Symfony 5.

Namespace

Drupal\Core\Http

Code

public function all(string $key = NULL) : array {
  if ($key === NULL) {
    return $this->parameters;
  }
  $value = $this->parameters[$key] ?? [];
  if (!is_array($value)) {
    throw new \UnexpectedValueException(sprintf('Unexpected value for parameter "%s": expecting "array", got "%s".', $key, get_debug_type($value)));
  }
  return $value;
}