public function HeaderBag::get in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/http-foundation/HeaderBag.php \Symfony\Component\HttpFoundation\HeaderBag::get()
Returns a header value by name.
Parameters
string $key The header name:
mixed $default The default value:
bool $first Whether to return the first value or all header values:
Return value
string|array The first header value if $first is true, an array of values otherwise
2 calls to HeaderBag::get()
- HeaderBag::contains in vendor/
symfony/ http-foundation/ HeaderBag.php - Returns true if the given HTTP header contains the given value.
- HeaderBag::getDate in vendor/
symfony/ http-foundation/ HeaderBag.php - Returns the HTTP header value converted to a date.
File
- vendor/
symfony/ http-foundation/ HeaderBag.php, line 112
Class
- HeaderBag
- HeaderBag is a container for HTTP headers.
Namespace
Symfony\Component\HttpFoundationCode
public function get($key, $default = null, $first = true) {
$key = strtr(strtolower($key), '_', '-');
if (!array_key_exists($key, $this->headers)) {
if (null === $default) {
return $first ? null : array();
}
return $first ? $default : array(
$default,
);
}
if ($first) {
return count($this->headers[$key]) ? $this->headers[$key][0] : $default;
}
return $this->headers[$key];
}