← All changes
|
includes/sdk/google/guzzlehttp/guzzle/src/Exception/RequestException.php
+13
-13
1.2.3
→
1.4.1
View file →
| @@ -1,13 +1,13 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -namespace Dudlewebs\WPMCS\GuzzleHttp\Exception; | |
| 3 | +namespace Dudlewebs\WPMCS\GCP\GuzzleHttp\Exception; | |
| 4 | 4 | |
| 5 | -use Dudlewebs\WPMCS\GuzzleHttp\BodySummarizer; | |
| 6 | -use Dudlewebs\WPMCS\GuzzleHttp\BodySummarizerInterface; | |
| 7 | -use Dudlewebs\WPMCS\Psr\Http\Client\RequestExceptionInterface; | |
| 8 | -use Dudlewebs\WPMCS\Psr\Http\Message\RequestInterface; | |
| 9 | -use Dudlewebs\WPMCS\Psr\Http\Message\ResponseInterface; | |
| 5 | +use Dudlewebs\WPMCS\GCP\GuzzleHttp\BodySummarizer; | |
| 6 | +use Dudlewebs\WPMCS\GCP\GuzzleHttp\BodySummarizerInterface; | |
| 7 | +use Dudlewebs\WPMCS\GCP\Psr\Http\Client\RequestExceptionInterface; | |
| 8 | +use Dudlewebs\WPMCS\GCP\Psr\Http\Message\RequestInterface; | |
| 9 | +use Dudlewebs\WPMCS\GCP\Psr\Http\Message\ResponseInterface; | |
| 10 | 10 | /** |
| 11 | 11 | * HTTP Request exception |
| 12 | 12 | */ |
| 13 | 13 | class RequestException extends TransferException implements RequestExceptionInterface |
| @@ -35,9 +35,9 @@ | ||
| 35 | 35 | } |
| 36 | 36 | /** |
| 37 | 37 | * Wrap non-RequestExceptions with a RequestException |
| 38 | 38 | */ |
| 39 | - public static function wrapException(RequestInterface $request, \Throwable $e): RequestException | |
| 39 | + public static function wrapException(RequestInterface $request, \Throwable $e) : RequestException | |
| 40 | 40 | { |
| 41 | 41 | return $e instanceof RequestException ? $e : new RequestException($e->getMessage(), $request, null, $e); |
| 42 | 42 | } |
| 43 | 43 | /** |
| @@ -48,9 +48,9 @@ | ||
| 48 | 48 | * @param \Throwable|null $previous Previous exception |
| 49 | 49 | * @param array $handlerContext Optional handler context |
| 50 | 50 | * @param BodySummarizerInterface|null $bodySummarizer Optional body summarizer |
| 51 | 51 | */ |
| 52 | - public static function create(RequestInterface $request, ?ResponseInterface $response = null, ?\Throwable $previous = null, array $handlerContext = [], ?BodySummarizerInterface $bodySummarizer = null): self | |
| 52 | + public static function create(RequestInterface $request, ?ResponseInterface $response = null, ?\Throwable $previous = null, array $handlerContext = [], ?BodySummarizerInterface $bodySummarizer = null) : self | |
| 53 | 53 | { |
| 54 | 54 | if (!$response) { |
| 55 | 55 | return new self('Error completing request', $request, null, $previous, $handlerContext); |
| 56 | 56 | } |
| @@ -64,9 +64,9 @@ | ||
| 64 | 64 | } else { |
| 65 | 65 | $label = 'Unsuccessful request'; |
| 66 | 66 | $className = __CLASS__; |
| 67 | 67 | } |
| 68 | - $uri = \Dudlewebs\WPMCS\GuzzleHttp\Psr7\Utils::redactUserInfo($request->getUri()); | |
| 68 | + $uri = \Dudlewebs\WPMCS\GCP\GuzzleHttp\Psr7\Utils::redactUserInfo($request->getUri()); | |
| 69 | 69 | // Client Error: `GET /` resulted in a `404 Not Found` response: |
| 70 | 70 | // <html> ... (truncated) |
| 71 | 71 | $message = \sprintf('%s: `%s %s` resulted in a `%s %s` response', $label, $request->getMethod(), $uri->__toString(), $response->getStatusCode(), $response->getReasonPhrase()); |
| 72 | 72 | $summary = ($bodySummarizer ?? new BodySummarizer())->summarize($response); |
| @@ -77,9 +77,9 @@ | ||
| 77 | 77 | } |
| 78 | 78 | /** |
| 79 | 79 | * Get the request that caused the exception |
| 80 | 80 | */ |
| 81 | - public function getRequest(): RequestInterface | |
| 81 | + public function getRequest() : RequestInterface | |
| 82 | 82 | { |
| 83 | 83 | return $this->request; |
| 84 | 84 | } |
| 85 | 85 | /** |
| @@ -84,9 +84,9 @@ | ||
| 84 | 84 | } |
| 85 | 85 | /** |
| 86 | 86 | * Get the associated response |
| 87 | 87 | */ |
| 88 | - public function getResponse(): ?ResponseInterface | |
| 88 | + public function getResponse() : ?ResponseInterface | |
| 89 | 89 | { |
| 90 | 90 | return $this->response; |
| 91 | 91 | } |
| 92 | 92 | /** |
| @@ -91,9 +91,9 @@ | ||
| 91 | 91 | } |
| 92 | 92 | /** |
| 93 | 93 | * Check if a response was received |
| 94 | 94 | */ |
| 95 | - public function hasResponse(): bool | |
| 95 | + public function hasResponse() : bool | |
| 96 | 96 | { |
| 97 | 97 | return $this->response !== null; |
| 98 | 98 | } |
| 99 | 99 | /** |
| @@ -103,9 +103,9 @@ | ||
| 103 | 103 | * using. It may also be just an empty array. Relying on this data will |
| 104 | 104 | * couple you to a specific handler, but can give more debug information |
| 105 | 105 | * when needed. |
| 106 | 106 | */ |
| 107 | - public function getHandlerContext(): array | |
| 107 | + public function getHandlerContext() : array | |
| 108 | 108 | { |
| 109 | 109 | return $this->handlerContext; |
| 110 | 110 | } |
| 111 | 111 | } |