Accept
extends AbstractAccept
in package
Accept Header
Tags
Table of Contents
Properties
- $fieldValueParts : array<string|int, stdClass>
- $regexAddType : string
- $sorted : bool
- Determines if since last mutation the stack was sorted
Methods
- addMediaType() : $this
- Add a media type, with the given priority
- fromString() : static
- Factory method: parse Accept header string
- getFieldName() : string
- Get field name
- 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>
- hasMediaType() : bool
- Does the header have the requested media type?
- match() : AcceptFieldValuePart|bool
- Match a media string against this header
- parseHeaderLine() : mixed
- Parse a full header line or just the field value part.
- toString() : string
- Cast to string
- 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() : AcceptFieldValuePart
- Parse the keys contained in the header line
- sortFieldValueParts() : void
- Sort the internal Field Value Parts
Properties
$fieldValueParts
protected
array<string|int, stdClass>
$fieldValueParts
= []
$regexAddType
protected
string
$regexAddType
= '#^([a-zA-Z+-]+|\*)/(\*|[a-zA-Z0-9+-]+)$#'
$sorted
Determines if since last mutation the stack was sorted
protected
bool
$sorted
= false
Methods
addMediaType()
Add a media type, with the given priority
public
addMediaType(string $type[, int|float $priority = 1 ][, array<string|int, mixed> $params = [] ]) : $this
Parameters
- $type : string
- $priority : int|float = 1
- $params : array<string|int, mixed> = []
Return values
$thisfromString()
Factory method: parse Accept header string
public
static fromString(string $headerLine) : static
Parameters
- $headerLine : string
Return values
staticgetFieldName()
Get field name
public
getFieldName() : string
Return values
stringgetFieldValue()
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:
hasMediaType()
Does the header have the requested media type?
public
hasMediaType(string $type) : bool
Parameters
- $type : string
Return values
boolmatch()
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
toString()
Cast to string
public
toString() : string
Return values
stringaddFieldValuePartToQueue()
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 keys contained in the header line
protected
parseFieldValuePart(string $fieldValuePart) : AcceptFieldValuePart
Parameters
- $fieldValuePart : string
Tags
Return values
AcceptFieldValuePartsortFieldValueParts()
Sort the internal Field Value Parts
protected
sortFieldValueParts() : void