Header
class Header implements Serializable (View source)
The http\Header class provides methods to manipulate, match, negotiate and serialize HTTP headers.
Constants
MATCH_LOOSE |
None of the following match constraints applies. |
MATCH_CASE |
Perform case sensitive matching. |
MATCH_WORD |
Match only on word boundaries (according by CType alpha-numeric). |
MATCH_FULL |
Match the complete string. |
MATCH_STRICT |
Case sensitively match the full string (same as MATCH_CASE|MATCH_FULL). |
Properties
string | $name | The name of the HTTP header. |
|
mixed | $value | The value of the HTTP header. |
Methods
Create an http\Header instance for use of simple matching or negotiation. If the value of the header is an array it may be compounded to a single comma separated string.
String cast handler. Alias of http\Header::serialize().
Create a parameter list out of the HTTP header value.
Match the HTTP header's value against provided $value according to $flags.
Negotiate the header's value against a list of supported values in $supported.
Parse HTTP headers.
Implements Serializable.
Convenience method. Alias of http\Header::serialize().
Implements Serializable.
Details
__construct(string $name = null, mixed $value = null)
Create an http\Header instance for use of simple matching or negotiation. If the value of the header is an array it may be compounded to a single comma separated string.
string
__toString()
String cast handler. Alias of http\Header::serialize().
Params
getParams(mixed $ps = null, mixed $as = null, mixed $vs = null, int $flags = null)
Create a parameter list out of the HTTP header value.
bool
match(string $value, int $flags = null)
Match the HTTP header's value against provided $value according to $flags.
string|null
negotiate(array $supported, array $result = null)
Negotiate the header's value against a list of supported values in $supported.
Negotiation operation is adopted according to the header name, i.e. if the header being negotiated is Accept, then a slash is used as primary type separator, and if the header is Accept-Language respectively, a hyphen is used instead.
NOTE: The first element of $supported serves as a default if no operand matches.
array|false
parse(string $header, string $header_class = null)
Parse HTTP headers.
See also http\Header\Parser.
string|null
serialize()
Implements Serializable.
string
toString()
Convenience method. Alias of http\Header::serialize().
void
unserialize(string $serialized)
Implements Serializable.