class AcceptHeader

Represents an Accept-* header.

An accept header is compound with a list of items, sorted by descending quality.

Methods

__construct(array $items)

Constructor.

static AcceptHeader
fromString(string $headerValue)

Builds an AcceptHeader instance from a string.

string
__toString()

Returns header value's string representation.

bool
has(string $value)

Tests if header has given value.

get(string $value)

Returns given value's item, if exists.

$this
add(AcceptHeaderItem $item)

Adds an item.

all()

Returns all items.

filter(string $pattern)

Filters items on their value using given regex.

first()

Returns first item.

Details

at line line 39
__construct(array $items)

Constructor.

Parameters

array $items

at line line 53
static AcceptHeader fromString(string $headerValue)

Builds an AcceptHeader instance from a string.

Parameters

string $headerValue

Return Value

AcceptHeader

at line line 70
string __toString()

Returns header value's string representation.

Return Value

string

at line line 82
bool has(string $value)

Tests if header has given value.

Parameters

string $value

Return Value

bool

at line line 94
AcceptHeaderItem|null get(string $value)

Returns given value's item, if exists.

Parameters

string $value

Return Value

AcceptHeaderItem|null

at line line 106
$this add(AcceptHeaderItem $item)

Adds an item.

Parameters

AcceptHeaderItem $item

Return Value

$this

at line line 119
AcceptHeaderItem[] all()

Returns all items.

Return Value

AcceptHeaderItem[]

at line line 133
AcceptHeader filter(string $pattern)

Filters items on their value using given regex.

Parameters

string $pattern

Return Value

AcceptHeader

at line line 145
AcceptHeaderItem|null first()

Returns first item.

Return Value

AcceptHeaderItem|null