Abstract Accept Header

Naming conventions:

Accept: audio/mp3; q=0.2; version=0.5, audio/basic+mp3 |------------------------------------------------------| header line |------| field name |-----------------------------------------------| field value |-------------------------------| field value part |------| type |--| subtype |--| format |----| subtype |---| format |-------------------| parameter set |-----------| parameter |-----| parameter key |--| parameter value |---| priority

see \Zend\Http\Header\http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.1
author Dolf Schimmel - Freeaqingme

 Methods

Factory method: parse Accept header string

fromString(string $headerLine) : \Zend\Http\Header\Accept

Parameters

$headerLine

string

Returns

getFieldName()

getFieldName() 
Inherited

inherited_from \Zend\Http\Header\HeaderInterface::getFieldName()

Get field value

getFieldValue(array | null $values) : string

Parameters

$values

arraynull

Returns

string

Parse the Field Value Parts represented by a header line

getFieldValuePartsFromHeaderLine(string $headerLine) : array

Parameters

$headerLine

string

Exceptions

\Zend\Http\Header\Exception\InvalidArgumentException If header is invalid

Returns

array

getPrioritized()

getPrioritized() : array

Returns

arraywith all the keys, values and parameters this header represents:

Match a media string against this header

match(array | string $matchAgainst) : \Zend\Http\Header\AcceptFieldValuePart | bool

Parameters

$matchAgainst

arraystring

Returns

\Zend\Http\Header\AcceptFieldValuePartboolThe matched value or false

parseHeaderLine()

parseHeaderLine(string $headerLine) 

Parameters

$headerLine

string

toString()

toString() 
Inherited

inherited_from \Zend\Http\Header\HeaderInterface::toString()

Add a key/value combination to the internal queue

addFieldValuePartToQueue(\stdClass $value) : \Zend\Http\Header\number

Parameters

$value

\stdClass

Returns

\Zend\Http\Header\number

Add a type, with the given priority

addType(string $type, int | float $priority, array $params) : \Zend\Http\Header\Accept

Parameters

$type

string

$priority

intfloat

$params

array

(optional) $params

Exceptions

\Zend\Http\Header\Exception\InvalidArgumentException

Returns

Assemble and escape the field value parameters based on RFC 2616 section 2.1

assembleAcceptParam(string $value, string $key) : string

todo someone should review this thoroughly

Parameters

$value

string

$key

string

Returns

string

Parse the keys contained in the header line

getParametersFromFieldValuePart(string $fieldValuePart) : array

Parameters

$fieldValuePart

string

Returns

array

Does the header have the requested type?

hasType(array | string $matchAgainst) : bool

Parameters

$matchAgainst

arraystring

Returns

bool

Return a match where all parameters in argument #1 match those in argument #2

matchAcceptParams(array $match1, array $match2) : bool | array

Parameters

$match1

array

$match2

array

Returns

boolarray

Parse the accept params belonging to a media range

parseFieldValuePart(string $fieldValuePart) : \stdClass

Parameters

$fieldValuePart

string

Returns

Sort the internal Field Value Parts

sortFieldValueParts() : \Zend\Http\Header\number

See sect 14.1 Media ranges can be overridden by more specific media ranges or specific media types. If more than one media range applies to a given type, the most specific reference has precedence. For example, Accept: text/*, text/html, text/html;level=1, * /* have the following precedence: 1) text/html;level=1 2) text/html 3) text/* 4) * /*

Returns

\Zend\Http\Header\number

 Properties

 

$fieldValueParts

$fieldValueParts : array

 

$regexAddType

$regexAddType 

 

Determines if since last mutation the stack was sorted

$sorted : bool