HumHub Documentation (unofficial)

AcceptEncoding extends AbstractAccept
in package

Accept Encoding Header

Tags
see
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.3

Table of Contents

Properties

$fieldValueParts  : array<string|int, stdClass>
$regexAddType  : string
$sorted  : bool
Determines if since last mutation the stack was sorted

Methods

addEncoding()  : $this
Add an encoding, 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>
hasEncoding()  : bool
Does the header have the requested encoding?
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()  : EncodingFieldValuePart
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-Z0-9+-]+|\*)$#'

$sorted

Determines if since last mutation the stack was sorted

protected bool $sorted = false

Methods

addEncoding()

Add an encoding, with the given priority

public addEncoding(string $type[, int|float $priority = 1 ]) : $this
Parameters
$type : string
$priority : int|float = 1
Return values
$this

fromString()

Factory method: parse Accept header string

public static fromString(string $headerLine) : static
Parameters
$headerLine : string
Return values
static

getFieldName()

Get field name

public getFieldName() : string
Return values
string

getFieldValue()

Get field value

public getFieldValue([array<string|int, mixed>|null $values = null ]) : string
Parameters
$values : array<string|int, mixed>|null = null
Return values
string

getFieldValuePartsFromHeaderLine()

Parse the Field Value Parts represented by a header line

public getFieldValuePartsFromHeaderLine(string $headerLine) : array<string|int, mixed>
Parameters
$headerLine : string
Tags
throws
InvalidArgumentException

If header is invalid.

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:

hasEncoding()

Does the header have the requested encoding?

public hasEncoding(string $type) : bool
Parameters
$type : string
Return values
bool

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

toString()

Cast to string

public toString() : string
Return values
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
throws
InvalidArgumentException
Return values
$this

assembleAcceptParam()

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
todo

someone should review this thoroughly

Return values
string

getParametersFromFieldValuePart()

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
bool

matchAcceptParams()

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>

sortFieldValueParts()

Sort the internal Field Value Parts

protected sortFieldValueParts() : void
Tags
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/*
    • /*

        
On this page

Search results