ResponseHeaderBag
class ResponseHeaderBag extends HeaderBag
ResponseHeaderBag is a container for Response HTTP headers.
Constants
COOKIES_FLAT |
|
COOKIES_ARRAY |
|
DISPOSITION_ATTACHMENT |
|
DISPOSITION_INLINE |
|
Methods
Constructor.
Returns the headers as a string.
Replaces the current HTTP headers by a new set.
Returns a header value by name.
Sets a header by name.
Returns true if the given HTTP header contains the given value.
Removes a header.
Adds a custom Cache-Control directive.
Returns true if the Cache-Control directive is defined.
Returns a Cache-Control directive value by name.
Returns the headers, with original capitalizations.
Removes a cookie from the array, but does not unset it in the browser.
Returns an array with all cookies.
Clears a cookie in the browser.
Generates a HTTP Content-Disposition field-value.
Details
at line line 47
__construct(array $headers = array())
Constructor.
at line line 59
string
__toString()
Returns the headers as a string.
in HeaderBag at line line 65
array
all()
Returns the headers.
in HeaderBag at line line 75
array
keys()
Returns the parameter keys.
at line line 84
replace(array $headers = array())
Replaces the current HTTP headers by a new set.
in HeaderBag at line line 96
add(array $headers)
Adds new headers the current HTTP headers set.
in HeaderBag at line line 112
string|array
get(string $key, mixed $default = null, bool $first = true)
Returns a header value by name.
at line line 98
set(string $key, string|array $values, bool $replace = true)
Sets a header by name.
in HeaderBag at line line 162
bool
has(string $key)
Returns true if the HTTP header is defined.
in HeaderBag at line line 175
bool
contains(string $key, string $value)
Returns true if the given HTTP header contains the given value.
at line line 117
remove(string $key)
Removes a header.
in HeaderBag at line line 206
null|DateTime
getDate(string $key, DateTime $default = null)
Returns the HTTP header value converted to a date.
in HeaderBag at line line 225
addCacheControlDirective(string $key, mixed $value = true)
Adds a custom Cache-Control directive.
at line line 132
bool
hasCacheControlDirective(string $key)
Returns true if the Cache-Control directive is defined.
at line line 140
mixed|null
getCacheControlDirective(string $key)
Returns a Cache-Control directive value by name.
in HeaderBag at line line 261
removeCacheControlDirective(string $key)
Removes a Cache-Control directive.
in HeaderBag at line line 273
ArrayIterator
getIterator()
Returns an iterator for headers.
in HeaderBag at line line 283
int
count()
Returns the number of headers.
at line line 76
array
allPreserveCase()
Returns the headers, with original capitalizations.
at line line 150
setCookie(Cookie $cookie)
Sets a cookie.
at line line 162
removeCookie(string $name, string $path = '/', string $domain = null)
Removes a cookie from the array, but does not unset it in the browser.
at line line 188
array
getCookies(string $format = self::COOKIES_FLAT)
Returns an array with all cookies.
at line line 219
clearCookie(string $name, string $path = '/', string $domain = null, bool $secure = false, bool $httpOnly = true)
Clears a cookie in the browser.
at line line 239
string
makeDisposition(string $disposition, string $filename, string $filenameFallback = '')
Generates a HTTP Content-Disposition field-value.