mirror of
https://github.com/linuxserver/Heimdall.git
synced 2025-12-03 05:29:53 +09:00
Update to laravel 7
This commit is contained in:
23
vendor/symfony/http-foundation/AcceptHeader.php
vendored
23
vendor/symfony/http-foundation/AcceptHeader.php
vendored
@@ -11,6 +11,9 @@
|
||||
|
||||
namespace Symfony\Component\HttpFoundation;
|
||||
|
||||
// Help opcache.preload discover always-needed symbols
|
||||
class_exists(AcceptHeaderItem::class);
|
||||
|
||||
/**
|
||||
* Represents an Accept-* header.
|
||||
*
|
||||
@@ -44,15 +47,13 @@ class AcceptHeader
|
||||
/**
|
||||
* Builds an AcceptHeader instance from a string.
|
||||
*
|
||||
* @param string $headerValue
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public static function fromString($headerValue)
|
||||
public static function fromString(?string $headerValue)
|
||||
{
|
||||
$index = 0;
|
||||
|
||||
$parts = HeaderUtils::split((string) $headerValue, ',;=');
|
||||
$parts = HeaderUtils::split($headerValue ?? '', ',;=');
|
||||
|
||||
return new self(array_map(function ($subParts) use (&$index) {
|
||||
$part = array_shift($subParts);
|
||||
@@ -78,11 +79,9 @@ class AcceptHeader
|
||||
/**
|
||||
* Tests if header has given value.
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function has($value)
|
||||
public function has(string $value)
|
||||
{
|
||||
return isset($this->items[$value]);
|
||||
}
|
||||
@@ -90,11 +89,9 @@ class AcceptHeader
|
||||
/**
|
||||
* Returns given value's item, if exists.
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return AcceptHeaderItem|null
|
||||
*/
|
||||
public function get($value)
|
||||
public function get(string $value)
|
||||
{
|
||||
return $this->items[$value] ?? $this->items[explode('/', $value)[0].'/*'] ?? $this->items['*/*'] ?? $this->items['*'] ?? null;
|
||||
}
|
||||
@@ -127,11 +124,9 @@ class AcceptHeader
|
||||
/**
|
||||
* Filters items on their value using given regex.
|
||||
*
|
||||
* @param string $pattern
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function filter($pattern)
|
||||
public function filter(string $pattern)
|
||||
{
|
||||
return new self(array_filter($this->items, function (AcceptHeaderItem $item) use ($pattern) {
|
||||
return preg_match($pattern, $item->getValue());
|
||||
@@ -153,7 +148,7 @@ class AcceptHeader
|
||||
/**
|
||||
* Sorts items by descending quality.
|
||||
*/
|
||||
private function sort()
|
||||
private function sort(): void
|
||||
{
|
||||
if (!$this->sorted) {
|
||||
uasort($this->items, function (AcceptHeaderItem $a, AcceptHeaderItem $b) {
|
||||
|
||||
Reference in New Issue
Block a user