Documentation

AcceptHeader
in package

Represents an Accept-* header.

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

Tags
author

Jean-François Simon contact@jfsimon.fr

Table of Contents

$items  : array<string|int, AcceptHeaderItem>
$sorted  : bool
__construct()  : mixed
__toString()  : string
Returns header value's string representation.
add()  : $this
Adds an item.
all()  : array<string|int, AcceptHeaderItem>
Returns all items.
filter()  : self
Filters items on their value using given regex.
first()  : AcceptHeaderItem|null
Returns first item.
fromString()  : self
Builds an AcceptHeader instance from a string.
get()  : AcceptHeaderItem|null
Returns given value's item, if exists.
has()  : bool
Tests if header has given value.
sort()  : void
Sorts items by descending quality.

Properties

Methods

__toString()

Returns header value's string representation.

public __toString() : string
Return values
string

filter()

Filters items on their value using given regex.

public filter(string $pattern) : self
Parameters
$pattern : string
Return values
self

fromString()

Builds an AcceptHeader instance from a string.

public static fromString(string|null $headerValue) : self
Parameters
$headerValue : string|null
Return values
self

has()

Tests if header has given value.

public has(string $value) : bool
Parameters
$value : string
Return values
bool

sort()

Sorts items by descending quality.

private sort() : void
Return values
void

Search results