public function ParameterBag::filter in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/http-foundation/ParameterBag.php \Symfony\Component\HttpFoundation\ParameterBag::filter()
Filter key.
Parameters
string $key Key.:
mixed $default Default = null.:
bool $deep Default = false.:
int $filter FILTER_* constant.:
mixed $options Filter options.:
Return value
mixed
See also
http://php.net/manual/en/function.filter-var.php
2 calls to ParameterBag::filter()
- ParameterBag::getBoolean in vendor/
symfony/ http-foundation/ ParameterBag.php - Returns the parameter value converted to boolean.
- ParameterBag::getDigits in vendor/
symfony/ http-foundation/ ParameterBag.php - Returns the digits of the parameter value.
File
- vendor/
symfony/ http-foundation/ ParameterBag.php, line 255
Class
- ParameterBag
- ParameterBag is a container for key/value pairs.
Namespace
Symfony\Component\HttpFoundationCode
public function filter($key, $default = null, $deep = false, $filter = FILTER_DEFAULT, $options = array()) {
$value = $this
->get($key, $default, $deep);
// Always turn $options into an array - this allows filter_var option shortcuts.
if (!is_array($options) && $options) {
$options = array(
'flags' => $options,
);
}
// Add a convenience check for arrays.
if (is_array($value) && !isset($options['flags'])) {
$options['flags'] = FILTER_REQUIRE_ARRAY;
}
return filter_var($value, $filter, $options);
}