function InputBag::all

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

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.