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
author Dolf Schimmel - Freeaqingme
package Default

 Methods

Factory method: parse Accept header string

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

Parameters

$headerLine

string

Returns

\Zend\Http\Header\Accept

Get field value

getFieldValue(array|null $values = null) : string
inherited_from \Zend\Http\Header\HeaderInterface::getFieldValue()

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\Accept\FieldValuePArt\AcceptFieldValuePart | boolean

Parameters

$matchAgainst

arraystring

Returns

\Zend\Http\Header\Accept\FieldValuePArt\AcceptFieldValuePartbooleanThe matched value or false

Parse a full header line or just the field value part.

parseHeaderLine(string $headerLine) 

Parameters

$headerLine

string

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, integer|float $priority = 1, array $params = array()) : \Zend\Http\Header\Accept

Parameters

$type

string

$priority

integerfloat

$params

Exceptions

\Zend\Http\Header\Exception\InvalidArgumentException

Returns

\Zend\Http\Header\Accept

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) : boolean

Parameters

$matchAgainst

arraystring

Returns

boolean

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

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

Parameters

$match1

array

$match2

array

Returns

booleanarray

Parse the accept params belonging to a media range

parseFieldValuePart(string $fieldValuePart) : \stdClass

Parameters

$fieldValuePart

string

Returns

\stdClass

Sort the internal Field Value Parts

sortFieldValueParts() : \Zend\Http\Header\number
See rfc2616 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<mixed,\stdClass>

Default

array()
 

$regexAddType

$regexAddType 

Default

 

Determines if since last mutation the stack was sorted

$sorted : boolean

Default

false