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

Add a media type, with the given priority

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

Parameters

$type

string

$priority

intfloat

$params

array

Returns

Factory method: parse Accept header string

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

inherited_from \Zend\Http\Header\AbstractAccept::fromString()

Parameters

$headerLine

string

Exceptions

\Zend\Http\Header\Exception\InvalidArgumentException If the header does not match RFC 2616 definition.

Returns

Get field name

getFieldName() : string

Returns

string

Get field value

getFieldValue(array | null $values) : string
Inherited

inherited_from \Zend\Http\Header\AbstractAccept::getFieldValue()

Parameters

$values

arraynull

Returns

string

Parse the Field Value Parts represented by a header line

getFieldValuePartsFromHeaderLine(string $headerLine) : array
Inherited

inherited_from \Zend\Http\Header\AbstractAccept::getFieldValuePartsFromHeaderLine()

Parameters

$headerLine

string

Exceptions

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

Returns

array

getPrioritized()

getPrioritized() : array
Inherited

inherited_from \Zend\Http\Header\AbstractAccept::getPrioritized()

Returns

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

Does the header have the requested media type?

hasMediaType(string $type) : bool

Parameters

$type

string

Returns

bool

Match a media string against this header

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

inherited_from \Zend\Http\Header\AbstractAccept::match()

Parameters

$matchAgainst

arraystring

Returns

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

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

parseHeaderLine(string $headerLine) 
Inherited

inherited_from \Zend\Http\Header\AbstractAccept::parseHeaderLine()

Parameters

$headerLine

string

Cast to string

toString() : string

Returns in form of "NAME: VALUE"

Returns

string

Add a key/value combination to the internal queue

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

inherited_from \Zend\Http\Header\AbstractAccept::addFieldValuePartToQueue()

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
Inherited

inherited_from \Zend\Http\Header\AbstractAccept::addType()

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
Inherited

inherited_from \Zend\Http\Header\AbstractAccept::assembleAcceptParam()

Parameters

$value

string

$key

string

Returns

string

Parse the keys contained in the header line

getParametersFromFieldValuePart(string $fieldValuePart) : array
Inherited

inherited_from \Zend\Http\Header\AbstractAccept::getParametersFromFieldValuePart()

Parameters

$fieldValuePart

string

Returns

array

Does the header have the requested type?

hasType(array | string $matchAgainst) : bool
Inherited

inherited_from \Zend\Http\Header\AbstractAccept::hasType()

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
Inherited

inherited_from \Zend\Http\Header\AbstractAccept::matchAcceptParams()

Parameters

$match1

array

$match2

array

Returns

boolarray

Parse the keys contained in the header line

parseFieldValuePart(string $fieldValuePart) : \Zend\Http\Header\Accept\FieldValuePart\AcceptFieldValuePart

see \Zend\Http\Header\AbstractAccept::parseFieldValuePart()

Parameters

$fieldValuePart

string

Returns

Sort the internal Field Value Parts

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

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) * /*
inherited_from \Zend\Http\Header\AbstractAccept::sortFieldValueParts()

Returns

\Zend\Http\Header\number

 Properties

 

$fieldValueParts

$fieldValueParts : \stdClass[]
Inherited

inherited_from \Zend\Http\Header\AbstractAccept::$$fieldValueParts
 

$regexAddType

$regexAddType : string

 

Determines if since last mutation the stack was sorted

$sorted : bool
Inherited

inherited_from \Zend\Http\Header\AbstractAccept::$$sorted