| @@ -119,9 +119,8 @@ | ||
| 119 | 119 | */ |
| 120 | 120 | public function send(RequestInterface $request, array $options = []): ResponseInterface |
| 121 | 121 | { |
| 122 | 122 | $options[RequestOptions::SYNCHRONOUS] = true; |
| 123 | - | |
| 124 | 123 | return $this->sendAsync($request, $options)->wait(); |
| 125 | 124 | } |
| 126 | 125 | |
| 127 | 126 | /** |
| @@ -126,9 +125,9 @@ | ||
| 126 | 125 | |
| 127 | 126 | /** |
| 128 | 127 | * The HttpClient PSR (PSR-18) specify this method. |
| 129 | 128 | * |
| 130 | - * {@inheritDoc} | |
| 129 | + * @inheritDoc | |
| 131 | 130 | */ |
| 132 | 131 | public function sendRequest(RequestInterface $request): ResponseInterface |
| 133 | 132 | { |
| 134 | 133 | $options[RequestOptions::SYNCHRONOUS] = true; |
| @@ -184,9 +183,8 @@ | ||
| 184 | 183 | */ |
| 185 | 184 | public function request(string $method, $uri = '', array $options = []): ResponseInterface |
| 186 | 185 | { |
| 187 | 186 | $options[RequestOptions::SYNCHRONOUS] = true; |
| 188 | - | |
| 189 | 187 | return $this->requestAsync($method, $uri, $options)->wait(); |
| 190 | 188 | } |
| 191 | 189 | |
| 192 | 190 | /** |
| @@ -201,9 +199,9 @@ | ||
| 201 | 199 | * @return mixed |
| 202 | 200 | * |
| 203 | 201 | * @deprecated Client::getConfig will be removed in guzzlehttp/guzzle:8.0. |
| 204 | 202 | */ |
| 205 | - public function getConfig(string $option = null) | |
| 203 | + public function getConfig(?string $option = null) | |
| 206 | 204 | { |
| 207 | 205 | return $option === null |
| 208 | 206 | ? $this->config |
| 209 | 207 | : ($this->config[$option] ?? null); |
| @@ -229,13 +227,13 @@ | ||
| 229 | 227 | private function configureDefaults(array $config): void |
| 230 | 228 | { |
| 231 | 229 | $defaults = [ |
| 232 | 230 | 'allow_redirects' => RedirectMiddleware::$defaultSettings, |
| 233 | - 'http_errors' => true, | |
| 234 | - 'decode_content' => true, | |
| 235 | - 'verify' => true, | |
| 236 | - 'cookies' => false, | |
| 237 | - 'idn_conversion' => false, | |
| 231 | + 'http_errors' => true, | |
| 232 | + 'decode_content' => true, | |
| 233 | + 'verify' => true, | |
| 234 | + 'cookies' => false, | |
| 235 | + 'idn_conversion' => false, | |
| 238 | 236 | ]; |
| 239 | 237 | |
| 240 | 238 | // Use the standard Linux HTTP_PROXY and HTTPS_PROXY if set. |
| 241 | 239 | |
| @@ -355,12 +353,12 @@ | ||
| 355 | 353 | |
| 356 | 354 | if (isset($options['form_params'])) { |
| 357 | 355 | if (isset($options['multipart'])) { |
| 358 | 356 | throw new InvalidArgumentException('You cannot use ' |
| 359 | - .'form_params and multipart at the same time. Use the ' | |
| 360 | - .'form_params option if you want to send application/' | |
| 361 | - .'x-www-form-urlencoded requests, and the multipart ' | |
| 362 | - .'option to send multipart/form-data requests.'); | |
| 357 | + . 'form_params and multipart at the same time. Use the ' | |
| 358 | + . 'form_params option if you want to send application/' | |
| 359 | + . 'x-www-form-urlencoded requests, and the multipart ' | |
| 360 | + . 'option to send multipart/form-data requests.'); | |
| 363 | 361 | } |
| 364 | 362 | $options['body'] = \http_build_query($options['form_params'], '', '&'); |
| 365 | 363 | unset($options['form_params']); |
| 366 | 364 | // Ensure that we don't have the header in different case and set the new value. |
| @@ -404,9 +402,9 @@ | ||
| 404 | 402 | case 'basic': |
| 405 | 403 | // Ensure that we don't have the header in different case and set the new value. |
| 406 | 404 | $modify['set_headers'] = Psr7\Utils::caselessRemove(['Authorization'], $modify['set_headers']); |
| 407 | 405 | $modify['set_headers']['Authorization'] = 'Basic ' |
| 408 | - .\base64_encode("$value[0]:$value[1]"); | |
| 406 | + . \base64_encode("$value[0]:$value[1]"); | |
| 409 | 407 | break; |
| 410 | 408 | case 'digest': |
| 411 | 409 | // @todo: Do not rely on curl |
| 412 | 410 | $options['curl'][\CURLOPT_HTTPAUTH] = \CURLAUTH_DIGEST; |
| @@ -438,12 +436,8 @@ | ||
| 438 | 436 | throw new InvalidArgumentException('sink must not be a boolean'); |
| 439 | 437 | } |
| 440 | 438 | } |
| 441 | 439 | |
| 442 | - if (isset($options['version'])) { | |
| 443 | - $modify['version'] = $options['version']; | |
| 444 | - } | |
| 445 | - | |
| 446 | 440 | $request = Psr7\Utils::modifyRequest($request, $modify); |
| 447 | 441 | if ($request->getBody() instanceof Psr7\MultipartStream) { |
| 448 | 442 | // Use a multipart/form-data POST if a Content-Type is not set. |
| 449 | 443 | // Ensure that we don't have the header in different case and set the new value. |
| @@ -448,9 +442,9 @@ | ||
| 448 | 442 | // Use a multipart/form-data POST if a Content-Type is not set. |
| 449 | 443 | // Ensure that we don't have the header in different case and set the new value. |
| 450 | 444 | $options['_conditional'] = Psr7\Utils::caselessRemove(['Content-Type'], $options['_conditional']); |
| 451 | 445 | $options['_conditional']['Content-Type'] = 'multipart/form-data; boundary=' |
| 452 | - .$request->getBody()->getBoundary(); | |
| 446 | + . $request->getBody()->getBoundary(); | |
| 453 | 447 | } |
| 454 | 448 | |
| 455 | 449 | // Merge in conditional headers if they are not present. |
| 456 | 450 | if (isset($options['_conditional'])) { |
| @@ -474,10 +468,10 @@ | ||
| 474 | 468 | */ |
| 475 | 469 | private function invalidBody(): InvalidArgumentException |
| 476 | 470 | { |
| 477 | 471 | return new InvalidArgumentException('Passing in the "body" request ' |
| 478 | - .'option as an array to send a request is not supported. ' | |
| 479 | - .'Please use the "form_params" request option to send a ' | |
| 480 | - .'application/x-www-form-urlencoded request, or the "multipart" ' | |
| 481 | - .'request option to send a multipart/form-data request.'); | |
| 472 | + . 'option as an array to send a request is not supported. ' | |
| 473 | + . 'Please use the "form_params" request option to send a ' | |
| 474 | + . 'application/x-www-form-urlencoded request, or the "multipart" ' | |
| 475 | + . 'request option to send a multipart/form-data request.'); | |
| 482 | 476 | } |
| 483 | 477 | } |