Methods summary
public
|
#
__construct( array $headers = array() )
Constructor.
Parameters
- $headers
array $headers An array of HTTP headers
Api
|
public
string
|
#
__toString( )
Returns the headers as a string.
Returns the headers as a string.
Returns
string The headers
|
public
array
|
#
all( )
Returns the headers.
Returns
array An array of headers
Api
|
public
array
|
#
keys( )
Returns the parameter keys.
Returns the parameter keys.
Returns
array An array of parameter keys
Api
|
public
|
#
replace( array $headers = array() )
Replaces the current HTTP headers by a new set.
Replaces the current HTTP headers by a new set.
Parameters
- $headers
array $headers An array of HTTP headers
Api
|
public
|
#
add( array $headers )
Adds new headers the current HTTP headers set.
Adds new headers the current HTTP headers set.
Parameters
- $headers
array $headers An array of HTTP headers
Api
|
public
string|array
|
#
get( string $key, mixed $default = null, Boolean $first = true )
Returns a header value by name.
Returns a header value by name.
Parameters
- $key
string $key The header name
- $default
mixed $default The default value
- $first
Boolean $first Whether to return the first value or all header values
Returns
string|array The first header value if $first is true, an array of values otherwise
Api
|
public
|
#
set( string $key, string|array $values, Boolean $replace = true )
Sets a header by name.
Parameters
- $key
string $key The key
- $values
string|array $values The value or an array of values
- $replace
Boolean $replace Whether to replace the actual value or not (true by default)
Api
|
public
Boolean
|
#
has( string $key )
Returns true if the HTTP header is defined.
Returns true if the HTTP header is defined.
Parameters
- $key
string $key The HTTP header
Returns
Boolean true if the parameter exists, false otherwise
Api
|
public
Boolean
|
#
contains( string $key, string $value )
Returns true if the given HTTP header contains the given value.
Returns true if the given HTTP header contains the given value.
Parameters
- $key
string $key The HTTP header name
- $value
string $value The HTTP value
Returns
Boolean true if the value is contained in the header, false otherwise
Api
|
public
|
#
remove( string $key )
Removes a header.
Parameters
- $key
string $key The HTTP header name
Api
|
public
null|DateTime
|
#
getDate( string $key, DateTime $default = null )
Returns the HTTP header value converted to a date.
Returns the HTTP header value converted to a date.
Parameters
- $key
string $key The parameter key
- $default
DateTime
$default The default value
Returns
null|DateTime The parsed DateTime or the default value if the header does not exist
Throws
Api
|
public
|
|
public
|
|
public
|
|
public
|
|
public
ArrayIterator
|
#
getIterator( )
Returns an iterator for headers.
Returns an iterator for headers.
Returns
Implementation of
|
public
integer
|
#
count( )
Returns the number of headers.
Returns the number of headers.
Returns
integer The number of headers
Implementation of
|
protected
array
|
#
parseCacheControl( string $header )
Parses a Cache-Control HTTP header.
Parses a Cache-Control HTTP header.
Parameters
- $header
string $header The value of the Cache-Control HTTP header
Returns
array An array representing the attribute values
|