提交的内容
This commit is contained in:
32
vendor/guzzlehttp/psr7/src/Uri.php
vendored
Executable file → Normal file
32
vendor/guzzlehttp/psr7/src/Uri.php
vendored
Executable file → Normal file
@ -41,14 +41,14 @@ class Uri implements UriInterface, \JsonSerializable
|
||||
/**
|
||||
* Unreserved characters for use in a regex.
|
||||
*
|
||||
* @see https://tools.ietf.org/html/rfc3986#section-2.3
|
||||
* @see https://datatracker.ietf.org/doc/html/rfc3986#section-2.3
|
||||
*/
|
||||
private const CHAR_UNRESERVED = 'a-zA-Z0-9_\-\.~';
|
||||
|
||||
/**
|
||||
* Sub-delims for use in a regex.
|
||||
*
|
||||
* @see https://tools.ietf.org/html/rfc3986#section-2.2
|
||||
* @see https://datatracker.ietf.org/doc/html/rfc3986#section-2.2
|
||||
*/
|
||||
private const CHAR_SUB_DELIMS = '!\$&\'\(\)\*\+,;=';
|
||||
private const QUERY_SEPARATORS_REPLACEMENT = ['=' => '%3D', '&' => '%26'];
|
||||
@ -107,7 +107,7 @@ class Uri implements UriInterface, \JsonSerializable
|
||||
{
|
||||
// If IPv6
|
||||
$prefix = '';
|
||||
if (preg_match('%^(.*://\[[0-9:a-f]+\])(.*?)$%', $url, $matches)) {
|
||||
if (preg_match('%^(.*://\[[0-9:a-fA-F]+\])(.*?)$%', $url, $matches)) {
|
||||
/** @var array{0:string, 1:string, 2:string} $matches */
|
||||
$prefix = $matches[1];
|
||||
$url = $matches[2];
|
||||
@ -162,7 +162,7 @@ class Uri implements UriInterface, \JsonSerializable
|
||||
* `file:///` is the more common syntax for the file scheme anyway (Chrome for example redirects to
|
||||
* that format).
|
||||
*
|
||||
* @see https://tools.ietf.org/html/rfc3986#section-5.3
|
||||
* @see https://datatracker.ietf.org/doc/html/rfc3986#section-5.3
|
||||
*/
|
||||
public static function composeComponents(?string $scheme, ?string $authority, string $path, ?string $query, ?string $fragment): string
|
||||
{
|
||||
@ -219,7 +219,7 @@ class Uri implements UriInterface, \JsonSerializable
|
||||
* @see Uri::isNetworkPathReference
|
||||
* @see Uri::isAbsolutePathReference
|
||||
* @see Uri::isRelativePathReference
|
||||
* @see https://tools.ietf.org/html/rfc3986#section-4
|
||||
* @see https://datatracker.ietf.org/doc/html/rfc3986#section-4
|
||||
*/
|
||||
public static function isAbsolute(UriInterface $uri): bool
|
||||
{
|
||||
@ -231,7 +231,7 @@ class Uri implements UriInterface, \JsonSerializable
|
||||
*
|
||||
* A relative reference that begins with two slash characters is termed an network-path reference.
|
||||
*
|
||||
* @see https://tools.ietf.org/html/rfc3986#section-4.2
|
||||
* @see https://datatracker.ietf.org/doc/html/rfc3986#section-4.2
|
||||
*/
|
||||
public static function isNetworkPathReference(UriInterface $uri): bool
|
||||
{
|
||||
@ -243,7 +243,7 @@ class Uri implements UriInterface, \JsonSerializable
|
||||
*
|
||||
* A relative reference that begins with a single slash character is termed an absolute-path reference.
|
||||
*
|
||||
* @see https://tools.ietf.org/html/rfc3986#section-4.2
|
||||
* @see https://datatracker.ietf.org/doc/html/rfc3986#section-4.2
|
||||
*/
|
||||
public static function isAbsolutePathReference(UriInterface $uri): bool
|
||||
{
|
||||
@ -258,7 +258,7 @@ class Uri implements UriInterface, \JsonSerializable
|
||||
*
|
||||
* A relative reference that does not begin with a slash character is termed a relative-path reference.
|
||||
*
|
||||
* @see https://tools.ietf.org/html/rfc3986#section-4.2
|
||||
* @see https://datatracker.ietf.org/doc/html/rfc3986#section-4.2
|
||||
*/
|
||||
public static function isRelativePathReference(UriInterface $uri): bool
|
||||
{
|
||||
@ -277,9 +277,9 @@ class Uri implements UriInterface, \JsonSerializable
|
||||
* @param UriInterface $uri The URI to check
|
||||
* @param UriInterface|null $base An optional base URI to compare against
|
||||
*
|
||||
* @see https://tools.ietf.org/html/rfc3986#section-4.4
|
||||
* @see https://datatracker.ietf.org/doc/html/rfc3986#section-4.4
|
||||
*/
|
||||
public static function isSameDocumentReference(UriInterface $uri, UriInterface $base = null): bool
|
||||
public static function isSameDocumentReference(UriInterface $uri, ?UriInterface $base = null): bool
|
||||
{
|
||||
if ($base !== null) {
|
||||
$uri = UriResolver::resolve($base, $uri);
|
||||
@ -336,8 +336,8 @@ class Uri implements UriInterface, \JsonSerializable
|
||||
*
|
||||
* It has the same behavior as withQueryValue() but for an associative array of key => value.
|
||||
*
|
||||
* @param UriInterface $uri URI to use as a base.
|
||||
* @param array<string, string|null> $keyValueArray Associative array of key and values
|
||||
* @param UriInterface $uri URI to use as a base.
|
||||
* @param (string|null)[] $keyValueArray Associative array of key and values
|
||||
*/
|
||||
public static function withQueryValues(UriInterface $uri, array $keyValueArray): UriInterface
|
||||
{
|
||||
@ -353,7 +353,7 @@ class Uri implements UriInterface, \JsonSerializable
|
||||
/**
|
||||
* Creates a URI from a hash of `parse_url` components.
|
||||
*
|
||||
* @see http://php.net/manual/en/function.parse-url.php
|
||||
* @see https://www.php.net/manual/en/function.parse-url.php
|
||||
*
|
||||
* @throws MalformedUriException If the components do not form a valid URI.
|
||||
*/
|
||||
@ -638,7 +638,7 @@ class Uri implements UriInterface, \JsonSerializable
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string[] $keys
|
||||
* @param (string|int)[] $keys
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
@ -650,7 +650,9 @@ class Uri implements UriInterface, \JsonSerializable
|
||||
return [];
|
||||
}
|
||||
|
||||
$decodedKeys = array_map('rawurldecode', $keys);
|
||||
$decodedKeys = array_map(function ($k): string {
|
||||
return rawurldecode((string) $k);
|
||||
}, $keys);
|
||||
|
||||
return array_filter(explode('&', $current), function ($part) use ($decodedKeys) {
|
||||
return !in_array(rawurldecode(explode('=', $part)[0]), $decodedKeys, true);
|
||||
|
||||
Reference in New Issue
Block a user