HeaderBag
class HeaderBag implements IteratorAggregate, Countable
HeaderBag is a container for HTTP headers.
Methods
No description
Returns the headers as a string.
Returns the headers.
Returns the parameter keys.
Replaces the current HTTP headers by a new set.
Adds new headers the current HTTP headers set.
Returns a header value by name.
Sets a header by name.
Returns true if the HTTP header is defined.
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.
Removes a Cache-Control directive.
Returns an iterator for headers.
Returns the number of headers.
Details
at line line 27
__construct(array $headers = array())
at line line 39
string
__toString()
Returns the headers as a string.
at line line 63
array
all()
Returns the headers.
at line line 73
array
keys()
Returns the parameter keys.
at line line 83
replace(array $headers = array())
Replaces the current HTTP headers by a new set.
at line line 94
add(array $headers)
Adds new headers the current HTTP headers set.
at line line 110
string|string[]
get(string $key, string|string[] $default = null, bool $first = true)
Returns a header value by name.
at line line 136
set(string $key, string|string[] $values, bool $replace = true)
Sets a header by name.
at line line 160
bool
has(string $key)
Returns true if the HTTP header is defined.
at line line 173
bool
contains(string $key, string $value)
Returns true if the given HTTP header contains the given value.
at line line 183
remove(string $key)
Removes a header.
at line line 204
null|DateTime
getDate(string $key, DateTime $default = null)
Returns the HTTP header value converted to a date.
at line line 223
addCacheControlDirective(string $key, mixed $value = true)
Adds a custom Cache-Control directive.
at line line 237
bool
hasCacheControlDirective(string $key)
Returns true if the Cache-Control directive is defined.
at line line 249
mixed|null
getCacheControlDirective(string $key)
Returns a Cache-Control directive value by name.
at line line 259
removeCacheControlDirective(string $key)
Removes a Cache-Control directive.
at line line 271
ArrayIterator
getIterator()
Returns an iterator for headers.
at line line 281
int
count()
Returns the number of headers.