Documentation

QualityValue
in package

HTTP quality value class

Generic RFC 7231 Section 5.3.1 "value;q=N" list parser - has no knowledge of media types, so it applies equally to Accept, Accept-Language, Accept-Encoding and Accept-Charset.

Tags
category

Pop

author

Nick Sagona, III nick@popphp.org

copyright

Copyright (c) 2009-2026 Nick Sagona, III

license

https://www.popphp.org/license New BSD License

version
6.0.0

Table of Contents

Properties

$quality  : float
The quality weight, 0.0 - 1.0
$value  : string
The raw value (e.g. 'text/html', 'en-US')

Methods

__construct()  : mixed
Constructor
getQuality()  : float
Get the quality weight
getValue()  : string
Get the raw value
parseList()  : array<string|int, QualityValue>
Parse a raw header value into a list of QualityValue entries, sorted by quality descending (stable sort - original order preserved among entries of equal quality).

Properties

$quality

The quality weight, 0.0 - 1.0

protected float $quality

$value

The raw value (e.g. 'text/html', 'en-US')

protected string $value

Methods

__construct()

Constructor

public __construct(string $value[, float $quality = 1.0 ]) : mixed
Parameters
$value : string
$quality : float = 1.0

getQuality()

Get the quality weight

public getQuality() : float
Return values
float

getValue()

Get the raw value

public getValue() : string
Return values
string

parseList()

Parse a raw header value into a list of QualityValue entries, sorted by quality descending (stable sort - original order preserved among entries of equal quality).

public static parseList(string $header) : array<string|int, QualityValue>

A missing or malformed 'q' parameter defaults to 1.0 rather than being dropped or throwing - this is client-controlled input, and a malformed weight shouldn't fail the request, only fail to deprioritize correctly.

Parameters
$header : string
Return values
array<string|int, QualityValue>

        
On this page

Search results