| @@ 180-194 (lines=15) @@ | ||
| 177 | return (string) self::normalize($uri1, $normalizations) === (string) self::normalize($uri2, $normalizations); |
|
| 178 | } |
|
| 179 | ||
| 180 | private static function capitalizePercentEncoding(UriInterface $uri) |
|
| 181 | { |
|
| 182 | $regex = '/(?:%[A-Fa-f0-9]{2})++/'; |
|
| 183 | ||
| 184 | $callback = function (array $match) { |
|
| 185 | return strtoupper($match[0]); |
|
| 186 | }; |
|
| 187 | ||
| 188 | return |
|
| 189 | $uri->withPath( |
|
| 190 | preg_replace_callback($regex, $callback, $uri->getPath()) |
|
| 191 | )->withQuery( |
|
| 192 | preg_replace_callback($regex, $callback, $uri->getQuery()) |
|
| 193 | ); |
|
| 194 | } |
|
| 195 | ||
| 196 | private static function decodeUnreservedCharacters(UriInterface $uri) |
|
| 197 | { |
|
| @@ 196-210 (lines=15) @@ | ||
| 193 | ); |
|
| 194 | } |
|
| 195 | ||
| 196 | private static function decodeUnreservedCharacters(UriInterface $uri) |
|
| 197 | { |
|
| 198 | $regex = '/%(?:2D|2E|5F|7E|3[0-9]|[46][1-9A-F]|[57][0-9A])/i'; |
|
| 199 | ||
| 200 | $callback = function (array $match) { |
|
| 201 | return rawurldecode($match[0]); |
|
| 202 | }; |
|
| 203 | ||
| 204 | return |
|
| 205 | $uri->withPath( |
|
| 206 | preg_replace_callback($regex, $callback, $uri->getPath()) |
|
| 207 | )->withQuery( |
|
| 208 | preg_replace_callback($regex, $callback, $uri->getQuery()) |
|
| 209 | ); |
|
| 210 | } |
|
| 211 | ||
| 212 | private function __construct() |
|
| 213 | { |
|