← All changes
|
vendor_prefixed/guzzlehttp/guzzle/src/functions.php
+76
-181
18.4
→
trunk
View file →
| @@ -1,45 +1,22 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace YoastSEO_Vendor\GuzzleHttp; |
| 4 | 4 | |
| 5 | -use YoastSEO_Vendor\GuzzleHttp\Exception\InvalidArgumentException; | |
| 6 | -use YoastSEO_Vendor\GuzzleHttp\Handler\CurlHandler; | |
| 7 | -use YoastSEO_Vendor\GuzzleHttp\Handler\CurlMultiHandler; | |
| 8 | -use YoastSEO_Vendor\GuzzleHttp\Handler\Proxy; | |
| 9 | -use YoastSEO_Vendor\GuzzleHttp\Handler\StreamHandler; | |
| 10 | -use YoastSEO_Vendor\Psr\Http\Message\UriInterface; | |
| 11 | 5 | /** |
| 12 | - * Expands a URI template | |
| 13 | - * | |
| 14 | - * @param string $template URI template | |
| 15 | - * @param array $variables Template variables | |
| 16 | - * | |
| 17 | - * @return string | |
| 18 | - */ | |
| 19 | -function uri_template($template, array $variables) | |
| 20 | -{ | |
| 21 | - if (\extension_loaded('uri_template')) { | |
| 22 | - // @codeCoverageIgnoreStart | |
| 23 | - return \YoastSEO_Vendor\uri_template($template, $variables); | |
| 24 | - // @codeCoverageIgnoreEnd | |
| 25 | - } | |
| 26 | - static $uriTemplate; | |
| 27 | - if (!$uriTemplate) { | |
| 28 | - $uriTemplate = new \YoastSEO_Vendor\GuzzleHttp\UriTemplate(); | |
| 29 | - } | |
| 30 | - return $uriTemplate->expand($template, $variables); | |
| 31 | -} | |
| 32 | -/** | |
| 33 | 6 | * Debug function used to describe the provided value type and class. |
| 34 | 7 | * |
| 35 | - * @param mixed $input | |
| 8 | + * @param mixed $input Any type of variable to describe the type of. This | |
| 9 | + * parameter misses a typehint because of that. | |
| 36 | 10 | * |
| 37 | 11 | * @return string Returns a string containing the type of the variable and |
| 38 | 12 | * if a class is provided, the class name. |
| 13 | + * | |
| 14 | + * @deprecated describe_type will be removed in guzzlehttp/guzzle:8.0. Use get_debug_type() instead. | |
| 39 | 15 | */ |
| 40 | -function describe_type($input) | |
| 16 | +function describe_type($input) : string | |
| 41 | 17 | { |
| 18 | + \YoastSEO_Vendor\trigger_deprecation('guzzlehttp/guzzle', '7.1', '%s() is deprecated and will be removed in 8.0. Use get_debug_type() instead.', __FUNCTION__); | |
| 42 | 19 | switch (\gettype($input)) { |
| 43 | 20 | case 'object': |
| 44 | 21 | return 'object(' . \get_class($input) . ')'; |
| 45 | 22 | case 'array': |
| @@ -47,9 +24,11 @@ | ||
| 47 | 24 | default: |
| 48 | 25 | \ob_start(); |
| 49 | 26 | \var_dump($input); |
| 50 | 27 | // normalize float vs double |
| 51 | - return \str_replace('double(', 'float(', \rtrim(\ob_get_clean())); | |
| 28 | + /** @var string $varDumpContent */ | |
| 29 | + $varDumpContent = \ob_get_clean(); | |
| 30 | + return \str_replace('double(', 'float(', \rtrim($varDumpContent, " \n\r\t\x00\v")); | |
| 52 | 31 | } |
| 53 | 32 | } |
| 54 | 33 | /** |
| 55 | 34 | * Parses an array of header lines into an associative array of headers. |
| @@ -54,19 +33,16 @@ | ||
| 54 | 33 | /** |
| 55 | 34 | * Parses an array of header lines into an associative array of headers. |
| 56 | 35 | * |
| 57 | 36 | * @param iterable $lines Header lines array of strings in the following |
| 58 | - * format: "Name: Value" | |
| 59 | - * @return array | |
| 37 | + * format: "Name: Value" | |
| 38 | + * | |
| 39 | + * @deprecated headers_from_lines will be removed in guzzlehttp/guzzle:8.0. Use Utils::headersFromLines instead. | |
| 60 | 40 | */ |
| 61 | -function headers_from_lines($lines) | |
| 41 | +function headers_from_lines(iterable $lines) : array | |
| 62 | 42 | { |
| 63 | - $headers = []; | |
| 64 | - foreach ($lines as $line) { | |
| 65 | - $parts = \explode(':', $line, 2); | |
| 66 | - $headers[\trim($parts[0])][] = isset($parts[1]) ? \trim($parts[1]) : null; | |
| 67 | - } | |
| 68 | - return $headers; | |
| 43 | + \YoastSEO_Vendor\trigger_deprecation('guzzlehttp/guzzle', '7.1', '%s() is deprecated and will be removed in 8.0. Use Utils::headersFromLines() instead.', __FUNCTION__); | |
| 44 | + return \YoastSEO_Vendor\GuzzleHttp\Utils::headersFromLines($lines); | |
| 69 | 45 | } |
| 70 | 46 | /** |
| 71 | 47 | * Returns a debug stream based on the provided variable. |
| 72 | 48 | * |
| @@ -72,17 +48,15 @@ | ||
| 72 | 48 | * |
| 73 | 49 | * @param mixed $value Optional value |
| 74 | 50 | * |
| 75 | 51 | * @return resource |
| 52 | + * | |
| 53 | + * @deprecated debug_resource will be removed in guzzlehttp/guzzle:8.0. Use Utils::debugResource instead. | |
| 76 | 54 | */ |
| 77 | 55 | function debug_resource($value = null) |
| 78 | 56 | { |
| 79 | - if (\is_resource($value)) { | |
| 80 | - return $value; | |
| 81 | - } elseif (\defined('STDOUT')) { | |
| 82 | - return \STDOUT; | |
| 83 | - } | |
| 84 | - return \fopen('php://output', 'w'); | |
| 57 | + \YoastSEO_Vendor\trigger_deprecation('guzzlehttp/guzzle', '7.1', '%s() is deprecated and will be removed in 8.0. Use Utils::debugResource() instead.', __FUNCTION__); | |
| 58 | + return \YoastSEO_Vendor\GuzzleHttp\Utils::debugResource($value); | |
| 85 | 59 | } |
| 86 | 60 | /** |
| 87 | 61 | * Chooses and creates a default handler to use based on the environment. |
| 88 | 62 | * |
| @@ -87,44 +61,28 @@ | ||
| 87 | 61 | * Chooses and creates a default handler to use based on the environment. |
| 88 | 62 | * |
| 89 | 63 | * The returned handler is not wrapped by any default middlewares. |
| 90 | 64 | * |
| 65 | + * @return callable(\Psr\Http\Message\RequestInterface, array): Promise\PromiseInterface Returns the best handler for the given system. | |
| 66 | + * | |
| 91 | 67 | * @throws \RuntimeException if no viable Handler is available. |
| 92 | - * @return callable Returns the best handler for the given system. | |
| 68 | + * | |
| 69 | + * @deprecated choose_handler will be removed in guzzlehttp/guzzle:8.0. Use Utils::chooseHandler instead. | |
| 93 | 70 | */ |
| 94 | -function choose_handler() | |
| 71 | +function choose_handler() : callable | |
| 95 | 72 | { |
| 96 | - $handler = null; | |
| 97 | - if (\function_exists('curl_multi_exec') && \function_exists('curl_exec')) { | |
| 98 | - $handler = \YoastSEO_Vendor\GuzzleHttp\Handler\Proxy::wrapSync(new \YoastSEO_Vendor\GuzzleHttp\Handler\CurlMultiHandler(), new \YoastSEO_Vendor\GuzzleHttp\Handler\CurlHandler()); | |
| 99 | - } elseif (\function_exists('curl_exec')) { | |
| 100 | - $handler = new \YoastSEO_Vendor\GuzzleHttp\Handler\CurlHandler(); | |
| 101 | - } elseif (\function_exists('curl_multi_exec')) { | |
| 102 | - $handler = new \YoastSEO_Vendor\GuzzleHttp\Handler\CurlMultiHandler(); | |
| 103 | - } | |
| 104 | - if (\ini_get('allow_url_fopen')) { | |
| 105 | - $handler = $handler ? \YoastSEO_Vendor\GuzzleHttp\Handler\Proxy::wrapStreaming($handler, new \YoastSEO_Vendor\GuzzleHttp\Handler\StreamHandler()) : new \YoastSEO_Vendor\GuzzleHttp\Handler\StreamHandler(); | |
| 106 | - } elseif (!$handler) { | |
| 107 | - throw new \RuntimeException('GuzzleHttp requires cURL, the ' . 'allow_url_fopen ini setting, or a custom HTTP handler.'); | |
| 108 | - } | |
| 109 | - return $handler; | |
| 73 | + \YoastSEO_Vendor\trigger_deprecation('guzzlehttp/guzzle', '7.1', '%s() is deprecated and will be removed in 8.0. Use Utils::chooseHandler() instead.', __FUNCTION__); | |
| 74 | + return \YoastSEO_Vendor\GuzzleHttp\Utils::chooseHandler(); | |
| 110 | 75 | } |
| 111 | 76 | /** |
| 112 | - * Get the default User-Agent string to use with Guzzle | |
| 77 | + * Get the default User-Agent string to use with Guzzle. | |
| 113 | 78 | * |
| 114 | - * @return string | |
| 79 | + * @deprecated default_user_agent will be removed in guzzlehttp/guzzle:8.0. Use Utils::defaultUserAgent instead. | |
| 115 | 80 | */ |
| 116 | -function default_user_agent() | |
| 81 | +function default_user_agent() : string | |
| 117 | 82 | { |
| 118 | - static $defaultAgent = ''; | |
| 119 | - if (!$defaultAgent) { | |
| 120 | - $defaultAgent = 'GuzzleHttp/' . \YoastSEO_Vendor\GuzzleHttp\Client::VERSION; | |
| 121 | - if (\extension_loaded('curl') && \function_exists('curl_version')) { | |
| 122 | - $defaultAgent .= ' curl/' . \curl_version()['version']; | |
| 123 | - } | |
| 124 | - $defaultAgent .= ' PHP/' . \PHP_VERSION; | |
| 125 | - } | |
| 126 | - return $defaultAgent; | |
| 83 | + \YoastSEO_Vendor\trigger_deprecation('guzzlehttp/guzzle', '7.1', '%s() is deprecated and will be removed in 8.0. Use Utils::defaultUserAgent() instead.', __FUNCTION__); | |
| 84 | + return \YoastSEO_Vendor\GuzzleHttp\Utils::defaultUserAgent(); | |
| 127 | 85 | } |
| 128 | 86 | /** |
| 129 | 87 | * Returns the default cacert bundle for the current system. |
| 130 | 88 | * |
| @@ -135,13 +93,15 @@ | ||
| 135 | 93 | * disk, they will be utilized. |
| 136 | 94 | * |
| 137 | 95 | * Note: the result of this function is cached for subsequent calls. |
| 138 | 96 | * |
| 139 | - * @return string | |
| 140 | 97 | * @throws \RuntimeException if no bundle can be found. |
| 98 | + * | |
| 99 | + * @deprecated default_ca_bundle will be removed in guzzlehttp/guzzle:8.0. This function is not needed in PHP 5.6+. | |
| 141 | 100 | */ |
| 142 | -function default_ca_bundle() | |
| 101 | +function default_ca_bundle() : string | |
| 143 | 102 | { |
| 103 | + \YoastSEO_Vendor\trigger_deprecation('guzzlehttp/guzzle', '7.1', '%s() is deprecated and will be removed in 8.0. This function is not needed in PHP 5.6+.', __FUNCTION__); | |
| 144 | 104 | static $cached = null; |
| 145 | 105 | static $cafiles = [ |
| 146 | 106 | // Red Hat, CentOS, Fedora (provided by the ca-certificates package) |
| 147 | 107 | '/etc/pki/tls/certs/ca-bundle.crt', |
| @@ -176,17 +136,16 @@ | ||
| 176 | 136 | throw new \RuntimeException(<<<EOT |
| 177 | 137 | No system CA bundle could be found in any of the the common system locations. |
| 178 | 138 | PHP versions earlier than 5.6 are not properly configured to use the system's |
| 179 | 139 | CA bundle by default. In order to verify peer certificates, you will need to |
| 180 | -supply the path on disk to a certificate bundle to the 'verify' request | |
| 181 | -option: http://docs.guzzlephp.org/en/latest/clients.html#verify. If you do not | |
| 182 | -need a specific certificate bundle, then Mozilla provides a commonly used CA | |
| 183 | -bundle which can be downloaded here (provided by the maintainer of cURL): | |
| 184 | -https://raw.githubusercontent.com/bagder/ca-bundle/master/ca-bundle.crt. Once | |
| 185 | -you have a CA bundle available on disk, you can set the 'openssl.cafile' PHP | |
| 186 | -ini setting to point to the path to the file, allowing you to omit the 'verify' | |
| 187 | -request option. See http://curl.haxx.se/docs/sslcerts.html for more | |
| 188 | -information. | |
| 140 | +supply the path on disk to a certificate bundle to the 'verify' request option: | |
| 141 | +https://github.com/guzzle/guzzle/blob/7.15/docs/request-options.md#verify. If | |
| 142 | +you do not need a specific certificate bundle, then Mozilla provides a commonly | |
| 143 | +used CA bundle which can be downloaded here (provided by the maintainer of | |
| 144 | +cURL): https://curl.se/ca/cacert.pem. Once you have a CA bundle available on | |
| 145 | +disk, you can set the 'openssl.cafile' PHP ini setting to point to the path to | |
| 146 | +the file, allowing you to omit the 'verify' request option. See | |
| 147 | +https://curl.se/docs/sslcerts.html for more information. | |
| 189 | 148 | EOT |
| 190 | 149 | ); |
| 191 | 150 | } |
| 192 | 151 | /** |
| @@ -192,19 +151,14 @@ | ||
| 192 | 151 | /** |
| 193 | 152 | * Creates an associative array of lowercase header names to the actual |
| 194 | 153 | * header casing. |
| 195 | 154 | * |
| 196 | - * @param array $headers | |
| 197 | - * | |
| 198 | - * @return array | |
| 155 | + * @deprecated normalize_header_keys will be removed in guzzlehttp/guzzle:8.0. Use Utils::normalizeHeaderKeys instead. | |
| 199 | 156 | */ |
| 200 | -function normalize_header_keys(array $headers) | |
| 157 | +function normalize_header_keys(array $headers) : array | |
| 201 | 158 | { |
| 202 | - $result = []; | |
| 203 | - foreach (\array_keys($headers) as $key) { | |
| 204 | - $result[\strtolower($key)] = $key; | |
| 205 | - } | |
| 206 | - return $result; | |
| 159 | + \YoastSEO_Vendor\trigger_deprecation('guzzlehttp/guzzle', '7.1', '%s() is deprecated and will be removed in 8.0. Use Utils::normalizeHeaderKeys() instead.', __FUNCTION__); | |
| 160 | + return \YoastSEO_Vendor\GuzzleHttp\Utils::normalizeHeaderKeys($headers); | |
| 207 | 161 | } |
| 208 | 162 | /** |
| 209 | 163 | * Returns true if the provided host matches any of the no proxy areas. |
| 210 | 164 | * |
| @@ -218,62 +172,47 @@ | ||
| 218 | 172 | * 2. An exact match. |
| 219 | 173 | * 3. The area starts with "." and the area is the last part of the host. e.g. |
| 220 | 174 | * '.mit.edu' will match any host that ends with '.mit.edu'. |
| 221 | 175 | * |
| 222 | - * @param string $host Host to check against the patterns. | |
| 223 | - * @param array $noProxyArray An array of host patterns. | |
| 176 | + * @param string $host Host to check against the patterns. | |
| 177 | + * @param string[] $noProxyArray An array of host patterns. | |
| 224 | 178 | * |
| 225 | - * @return bool | |
| 179 | + * @throws Exception\InvalidArgumentException | |
| 180 | + * | |
| 181 | + * @deprecated is_host_in_noproxy will be removed in guzzlehttp/guzzle:8.0. Use Utils::isHostInNoProxy instead. | |
| 226 | 182 | */ |
| 227 | -function is_host_in_noproxy($host, array $noProxyArray) | |
| 183 | +function is_host_in_noproxy(string $host, array $noProxyArray) : bool | |
| 228 | 184 | { |
| 229 | - if (\strlen($host) === 0) { | |
| 230 | - throw new \InvalidArgumentException('Empty host provided'); | |
| 231 | - } | |
| 232 | - // Strip port if present. | |
| 233 | - if (\strpos($host, ':')) { | |
| 234 | - $host = \explode($host, ':', 2)[0]; | |
| 235 | - } | |
| 236 | - foreach ($noProxyArray as $area) { | |
| 237 | - // Always match on wildcards. | |
| 238 | - if ($area === '*') { | |
| 239 | - return \true; | |
| 240 | - } elseif (empty($area)) { | |
| 241 | - // Don't match on empty values. | |
| 242 | - continue; | |
| 243 | - } elseif ($area === $host) { | |
| 244 | - // Exact matches. | |
| 245 | - return \true; | |
| 246 | - } else { | |
| 247 | - // Special match if the area when prefixed with ".". Remove any | |
| 248 | - // existing leading "." and add a new leading ".". | |
| 249 | - $area = '.' . \ltrim($area, '.'); | |
| 250 | - if (\substr($host, -\strlen($area)) === $area) { | |
| 251 | - return \true; | |
| 252 | - } | |
| 253 | - } | |
| 254 | - } | |
| 255 | - return \false; | |
| 185 | + \YoastSEO_Vendor\trigger_deprecation('guzzlehttp/guzzle', '7.1', '%s() is deprecated and will be removed in 8.0. Use Utils::isHostInNoProxy() instead.', __FUNCTION__); | |
| 186 | + return \YoastSEO_Vendor\GuzzleHttp\Utils::isHostInNoProxy($host, $noProxyArray); | |
| 256 | 187 | } |
| 257 | 188 | /** |
| 258 | 189 | * Wrapper for json_decode that throws when an error occurs. |
| 259 | 190 | * |
| 260 | 191 | * @param string $json JSON data to parse |
| 261 | - * @param bool $assoc When true, returned objects will be converted | |
| 192 | + * @param bool $assoc When true, returned objects will be converted | |
| 262 | 193 | * into associative arrays. |
| 263 | 194 | * @param int $depth User specified recursion depth. |
| 264 | 195 | * @param int $options Bitmask of JSON decode options. |
| 265 | 196 | * |
| 266 | - * @return mixed | |
| 197 | + * @return object|array|string|int|float|bool|null | |
| 198 | + * | |
| 267 | 199 | * @throws Exception\InvalidArgumentException if the JSON cannot be decoded. |
| 268 | - * @link http://www.php.net/manual/en/function.json-decode.php | |
| 200 | + * | |
| 201 | + * @see https://www.php.net/manual/en/function.json-decode.php | |
| 202 | + * @deprecated json_decode will be removed in guzzlehttp/guzzle:8.0. Use PHP's json_decode() instead. | |
| 269 | 203 | */ |
| 270 | -function json_decode($json, $assoc = \false, $depth = 512, $options = 0) | |
| 204 | +function json_decode(string $json, bool $assoc = \false, int $depth = 512, int $options = 0) | |
| 271 | 205 | { |
| 206 | + \YoastSEO_Vendor\trigger_deprecation('guzzlehttp/guzzle', '7.1', '%s() is deprecated and will be removed in 8.0. Use PHP\'s json_decode() instead.', __FUNCTION__); | |
| 207 | + if ($depth < 1) { | |
| 208 | + throw new \YoastSEO_Vendor\GuzzleHttp\Exception\InvalidArgumentException('json_decode error: Maximum stack depth exceeded'); | |
| 209 | + } | |
| 272 | 210 | $data = \json_decode($json, $assoc, $depth, $options); |
| 273 | 211 | if (\JSON_ERROR_NONE !== \json_last_error()) { |
| 274 | 212 | throw new \YoastSEO_Vendor\GuzzleHttp\Exception\InvalidArgumentException('json_decode error: ' . \json_last_error_msg()); |
| 275 | 213 | } |
| 214 | + /** @var object|array|string|int|float|bool|null $data */ | |
| 276 | 215 | return $data; |
| 277 | 216 | } |
| 278 | 217 | /** |
| 279 | 218 | * Wrapper for JSON encoding that throws when an error occurs. |
| @@ -278,67 +217,23 @@ | ||
| 278 | 217 | /** |
| 279 | 218 | * Wrapper for JSON encoding that throws when an error occurs. |
| 280 | 219 | * |
| 281 | 220 | * @param mixed $value The value being encoded |
| 282 | - * @param int $options JSON encode option bitmask | |
| 283 | - * @param int $depth Set the maximum depth. Must be greater than zero. | |
| 221 | + * @param int $options JSON encode option bitmask | |
| 222 | + * @param int $depth Set the maximum depth. Must be greater than zero. | |
| 284 | 223 | * |
| 285 | - * @return string | |
| 286 | 224 | * @throws Exception\InvalidArgumentException if the JSON cannot be encoded. |
| 287 | - * @link http://www.php.net/manual/en/function.json-encode.php | |
| 225 | + * | |
| 226 | + * @see https://www.php.net/manual/en/function.json-encode.php | |
| 227 | + * @deprecated json_encode will be removed in guzzlehttp/guzzle:8.0. Use PHP's json_encode() instead. | |
| 288 | 228 | */ |
| 289 | -function json_encode($value, $options = 0, $depth = 512) | |
| 229 | +function json_encode($value, int $options = 0, int $depth = 512) : string | |
| 290 | 230 | { |
| 231 | + \YoastSEO_Vendor\trigger_deprecation('guzzlehttp/guzzle', '7.1', '%s() is deprecated and will be removed in 8.0. Use PHP\'s json_encode() instead.', __FUNCTION__); | |
| 232 | + /** @var positive-int $depth */ | |
| 291 | 233 | $json = \json_encode($value, $options, $depth); |
| 292 | 234 | if (\JSON_ERROR_NONE !== \json_last_error()) { |
| 293 | 235 | throw new \YoastSEO_Vendor\GuzzleHttp\Exception\InvalidArgumentException('json_encode error: ' . \json_last_error_msg()); |
| 294 | 236 | } |
| 237 | + /** @var non-empty-string $json */ | |
| 295 | 238 | return $json; |
| 296 | -} | |
| 297 | -/** | |
| 298 | - * Wrapper for the hrtime() or microtime() functions | |
| 299 | - * (depending on the PHP version, one of the two is used) | |
| 300 | - * | |
| 301 | - * @return float|mixed UNIX timestamp | |
| 302 | - * @internal | |
| 303 | - */ | |
| 304 | -function _current_time() | |
| 305 | -{ | |
| 306 | - return \function_exists('hrtime') ? \hrtime(\true) / 1000000000.0 : \microtime(\true); | |
| 307 | -} | |
| 308 | -/** | |
| 309 | - * @param int $options | |
| 310 | - * | |
| 311 | - * @return UriInterface | |
| 312 | - * | |
| 313 | - * @internal | |
| 314 | - */ | |
| 315 | -function _idn_uri_convert(\YoastSEO_Vendor\Psr\Http\Message\UriInterface $uri, $options = 0) | |
| 316 | -{ | |
| 317 | - if ($uri->getHost()) { | |
| 318 | - $idnaVariant = \defined('INTL_IDNA_VARIANT_UTS46') ? \INTL_IDNA_VARIANT_UTS46 : 0; | |
| 319 | - $asciiHost = $idnaVariant === 0 ? \idn_to_ascii($uri->getHost(), $options) : \idn_to_ascii($uri->getHost(), $options, $idnaVariant, $info); | |
| 320 | - if ($asciiHost === \false) { | |
| 321 | - $errorBitSet = isset($info['errors']) ? $info['errors'] : 0; | |
| 322 | - $errorConstants = \array_filter(\array_keys(\get_defined_constants()), function ($name) { | |
| 323 | - return \substr($name, 0, 11) === 'IDNA_ERROR_'; | |
| 324 | - }); | |
| 325 | - $errors = []; | |
| 326 | - foreach ($errorConstants as $errorConstant) { | |
| 327 | - if ($errorBitSet & \constant($errorConstant)) { | |
| 328 | - $errors[] = $errorConstant; | |
| 329 | - } | |
| 330 | - } | |
| 331 | - $errorMessage = 'IDN conversion failed'; | |
| 332 | - if ($errors) { | |
| 333 | - $errorMessage .= ' (errors: ' . \implode(', ', $errors) . ')'; | |
| 334 | - } | |
| 335 | - throw new \YoastSEO_Vendor\GuzzleHttp\Exception\InvalidArgumentException($errorMessage); | |
| 336 | - } else { | |
| 337 | - if ($uri->getHost() !== $asciiHost) { | |
| 338 | - // Replace URI only if the ASCII version is different | |
| 339 | - $uri = $uri->withHost($asciiHost); | |
| 340 | - } | |
| 341 | - } | |
| 342 | - } | |
| 343 | - return $uri; | |
| 344 | 239 | } |