private function AcceptHeader::sort in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/http-foundation/AcceptHeader.php \Symfony\Component\HttpFoundation\AcceptHeader::sort()
Sorts items by descending quality.
2 calls to AcceptHeader::sort()
- AcceptHeader::all in vendor/
symfony/ http-foundation/ AcceptHeader.php - Returns all items.
- AcceptHeader::first in vendor/
symfony/ http-foundation/ AcceptHeader.php - Returns first item.
File
- vendor/
symfony/ http-foundation/ AcceptHeader.php, line 155
Class
- AcceptHeader
- Represents an Accept-* header.
Namespace
Symfony\Component\HttpFoundationCode
private function sort() {
if (!$this->sorted) {
uasort($this->items, function ($a, $b) {
$qA = $a
->getQuality();
$qB = $b
->getQuality();
if ($qA === $qB) {
return $a
->getIndex() > $b
->getIndex() ? 1 : -1;
}
return $qA > $qB ? -1 : 1;
});
$this->sorted = true;
}
}