final class InputBag in Drupal 9
Forward compatibility class for Symfony 5.
@internal only used as a bridge from Symfony 4 to Symfony 5, will be removed in drupal:10.0.0.
Hierarchy
- class \Drupal\Core\Http\InputBag extends \Symfony\Component\HttpFoundation\ParameterBag
Expanded class hierarchy of InputBag
2 files declare their use of InputBag
- bootstrap.inc in core/
includes/ bootstrap.inc - Functions that need to be loaded on every Drupal request.
- InputBagTest.php in core/
tests/ Drupal/ Tests/ Core/ Http/ InputBagTest.php
1 string reference to 'InputBag'
- TrustedHostsTest::testRequestBags in core/
modules/ system/ tests/ src/ Functional/ System/ TrustedHostsTest.php - Tests that the request bags have the correct classes.
File
- core/
lib/ Drupal/ Core/ Http/ InputBag.php, line 13
Namespace
Drupal\Core\HttpView source
final class InputBag extends ParameterBag {
/**
* Returns the parameters.
*
* @param string|null $key
* The name of the parameter to return or null to get them all.
*
* @return array
* An array of parameters.
*/
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;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
InputBag:: |
public | function | Returns the parameters. |