You are here

private static function UriNormalizer::capitalizePercentEncoding in Lockr 7.3

1 call to UriNormalizer::capitalizePercentEncoding()
UriNormalizer::normalize in vendor/guzzlehttp/psr7/src/UriNormalizer.php
Returns a normalized URI.

File

vendor/guzzlehttp/psr7/src/UriNormalizer.php, line 180

Class

UriNormalizer
Provides methods to normalize and compare URIs.

Namespace

GuzzleHttp\Psr7

Code

private static function capitalizePercentEncoding(UriInterface $uri) {
  $regex = '/(?:%[A-Fa-f0-9]{2})++/';
  $callback = function (array $match) {
    return strtoupper($match[0]);
  };
  return $uri
    ->withPath(preg_replace_callback($regex, $callback, $uri
    ->getPath()))
    ->withQuery(preg_replace_callback($regex, $callback, $uri
    ->getQuery()));
}