class HeaderBag implements IteratorAggregate, Countable
HeaderBag is a container for HTTP headers.
Methods
|
__construct(array $headers = array())
Constructor. |
||
| string |
__toString()
Returns the headers as a string. |
|
| array |
all()
Returns the headers. |
|
| array |
keys()
Returns the parameter keys. |
|
|
replace(array $headers = array())
Replaces the current HTTP headers by a new set. |
||
|
add(array $headers)
Adds new headers the current HTTP headers set. |
||
| string|array |
get(string $key, mixed $default = null, Boolean $first = true)
Returns a header value by name. |
|
|
set(string $key, string|array $values, Boolean $replace = true)
Sets a header by name. |
||
| Boolean |
has(string $key)
Returns true if the HTTP header is defined. |
|
| Boolean |
contains(string $key, string $value)
Returns true if the given HTTP header contains the given value. |
|
|
remove(string $key)
Removes a header. |
||
| null|DateTime |
getDate(string $key, DateTime $default = null)
Returns the HTTP header value converted to a date. |
|
| addCacheControlDirective($key, $value = true) | ||
| hasCacheControlDirective($key) | ||
| getCacheControlDirective($key) | ||
| removeCacheControlDirective($key) | ||
| ArrayIterator |
getIterator()
Returns an iterator for headers. |
|
| int |
count()
Returns the number of headers. |
Details
at line 33
public
__construct(array $headers = array())
Constructor.
at line 47
public string
__toString()
Returns the headers as a string.
at line 73
public array
all()
Returns the headers.
at line 85
public array
keys()
Returns the parameter keys.
at line 97
public
replace(array $headers = array())
Replaces the current HTTP headers by a new set.
at line 110
public
add(array $headers)
Adds new headers the current HTTP headers set.
at line 128
public string|array
get(string $key, mixed $default = null, Boolean $first = true)
Returns a header value by name.
at line 156
public
set(string $key, string|array $values, Boolean $replace = true)
Sets a header by name.
at line 182
public Boolean
has(string $key)
Returns true if the HTTP header is defined.
at line 197
public Boolean
contains(string $key, string $value)
Returns true if the given HTTP header contains the given value.
at line 209
public
remove(string $key)
Removes a header.
at line 232
public null|DateTime
getDate(string $key, DateTime $default = null)
Returns the HTTP header value converted to a date.
at line 245
public
addCacheControlDirective($key, $value = true)
at line 252
public
hasCacheControlDirective($key)
at line 257
public
getCacheControlDirective($key)
at line 262
public
removeCacheControlDirective($key)
at line 274
public ArrayIterator
getIterator()
Returns an iterator for headers.
at line 284
public int
count()
Returns the number of headers.