AbstractAccept
in package
implements
HeaderInterface
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
Tags
Table of Contents
Interfaces
- HeaderInterface
- Interface for HTTP Header classes.
Properties
- $fieldValueParts : array<string|int, stdClass>
- $regexAddType : string
- $sorted : bool
- Determines if since last mutation the stack was sorted
Methods
- fromString() : static
- Factory method: parse Accept header string
- getFieldValue() : string
- Get field value
- getFieldValuePartsFromHeaderLine() : array<string|int, mixed>
- Parse the Field Value Parts represented by a header line
- getPrioritized() : array<string|int, mixed>
- match() : AcceptFieldValuePart|bool
- Match a media string against this header
- parseHeaderLine() : mixed
- Parse a full header line or just the field value part.
- addFieldValuePartToQueue() : void
- Add a key/value combination to the internal queue
- addType() : $this
- Add a type, with the given priority
- assembleAcceptParam() : string
- Assemble and escape the field value parameters based on RFC 2616 section 2.1
- getParametersFromFieldValuePart() : array<string|int, mixed>
- Parse the keys contained in the header line
- hasType() : bool
- Does the header have the requested type?
- matchAcceptParams() : bool|array<string|int, mixed>
- Return a match where all parameters in argument #1 match those in argument #2
- parseFieldValuePart() : stdClass
- Parse the accept params belonging to a media range
- sortFieldValueParts() : void
- Sort the internal Field Value Parts
Properties
$fieldValueParts
protected
array<string|int, stdClass>
$fieldValueParts
= []
$regexAddType
protected
string
$regexAddType
$sorted
Determines if since last mutation the stack was sorted
protected
bool
$sorted
= false
Methods
fromString()
Factory method: parse Accept header string
public
static fromString(string $headerLine) : static
Parameters
- $headerLine : string
Return values
staticgetFieldValue()
Get field value
public
getFieldValue([array<string|int, mixed>|null $values = null ]) : string
Parameters
- $values : array<string|int, mixed>|null = null
Return values
stringgetFieldValuePartsFromHeaderLine()
Parse the Field Value Parts represented by a header line
public
getFieldValuePartsFromHeaderLine(string $headerLine) : array<string|int, mixed>
Parameters
- $headerLine : string
Tags
Return values
array<string|int, mixed>getPrioritized()
public
getPrioritized() : array<string|int, mixed>
Return values
array<string|int, mixed> —with all the keys, values and parameters this header represents:
match()
Match a media string against this header
public
match(array<string|int, mixed>|string $matchAgainst) : AcceptFieldValuePart|bool
Parameters
- $matchAgainst : array<string|int, mixed>|string
Return values
AcceptFieldValuePart|bool —The matched value or false
parseHeaderLine()
Parse a full header line or just the field value part.
public
parseHeaderLine(string $headerLine) : mixed
Parameters
- $headerLine : string
addFieldValuePartToQueue()
Add a key/value combination to the internal queue
protected
addFieldValuePartToQueue(stdClass $value) : void
Parameters
- $value : stdClass
addType()
Add a type, with the given priority
protected
addType(string $type[, int|float $priority = 1 ][, array<string|int, mixed> $params = [] ]) : $this
Parameters
- $type : string
- $priority : int|float = 1
- $params : array<string|int, mixed> = []
Tags
Return values
$thisassembleAcceptParam()
Assemble and escape the field value parameters based on RFC 2616 section 2.1
protected
assembleAcceptParam(string &$value, string $key) : string
Parameters
- $value : string
- $key : string
Tags
Return values
stringgetParametersFromFieldValuePart()
Parse the keys contained in the header line
protected
getParametersFromFieldValuePart(string $fieldValuePart) : array<string|int, mixed>
Parameters
- $fieldValuePart : string
Return values
array<string|int, mixed>hasType()
Does the header have the requested type?
protected
hasType(array<string|int, mixed>|string $matchAgainst) : bool
Parameters
- $matchAgainst : array<string|int, mixed>|string
Return values
boolmatchAcceptParams()
Return a match where all parameters in argument #1 match those in argument #2
protected
matchAcceptParams(array<string|int, mixed> $match1, array<string|int, mixed> $match2) : bool|array<string|int, mixed>
Parameters
- $match1 : array<string|int, mixed>
- $match2 : array<string|int, mixed>
Return values
bool|array<string|int, mixed>parseFieldValuePart()
Parse the accept params belonging to a media range
protected
parseFieldValuePart(string $fieldValuePart) : stdClass
Parameters
- $fieldValuePart : string
Return values
stdClasssortFieldValueParts()
Sort the internal Field Value Parts
protected
sortFieldValueParts() : void