← All changes
|
includes/sdk/google/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php
+6
-6
1.2.2
→
1.4.2
View file →
| @@ -1,10 +1,10 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -namespace Dudlewebs\WPMCS\GuzzleHttp; | |
| 3 | +namespace Dudlewebs\WPMCS\GCP\GuzzleHttp; | |
| 4 | 4 | |
| 5 | -use Dudlewebs\WPMCS\GuzzleHttp\Promise\PromiseInterface; | |
| 6 | -use Dudlewebs\WPMCS\Psr\Http\Message\RequestInterface; | |
| 5 | +use Dudlewebs\WPMCS\GCP\GuzzleHttp\Promise\PromiseInterface; | |
| 6 | +use Dudlewebs\WPMCS\GCP\Psr\Http\Message\RequestInterface; | |
| 7 | 7 | /** |
| 8 | 8 | * Prepares requests that contain a body, adding the Content-Length, |
| 9 | 9 | * Content-Type, and Expect headers. |
| 10 | 10 | * |
| @@ -22,9 +22,9 @@ | ||
| 22 | 22 | public function __construct(callable $nextHandler) |
| 23 | 23 | { |
| 24 | 24 | $this->nextHandler = $nextHandler; |
| 25 | 25 | } |
| 26 | - public function __invoke(RequestInterface $request, array $options): PromiseInterface | |
| 26 | + public function __invoke(RequestInterface $request, array $options) : PromiseInterface | |
| 27 | 27 | { |
| 28 | 28 | $fn = $this->nextHandler; |
| 29 | 29 | // Don't do anything if the request has no body. |
| 30 | 30 | if ($request->getBody()->getSize() === 0) { |
| @@ -33,9 +33,9 @@ | ||
| 33 | 33 | $modify = []; |
| 34 | 34 | // Add a default content-type if possible. |
| 35 | 35 | if (!$request->hasHeader('Content-Type')) { |
| 36 | 36 | if ($uri = $request->getBody()->getMetadata('uri')) { |
| 37 | - if (is_string($uri) && $type = Psr7\MimeType::fromFilename($uri)) { | |
| 37 | + if (\is_string($uri) && ($type = Psr7\MimeType::fromFilename($uri))) { | |
| 38 | 38 | $modify['set_headers']['Content-Type'] = $type; |
| 39 | 39 | } |
| 40 | 40 | } |
| 41 | 41 | } |
| @@ -54,9 +54,9 @@ | ||
| 54 | 54 | } |
| 55 | 55 | /** |
| 56 | 56 | * Add expect header |
| 57 | 57 | */ |
| 58 | - private function addExpectHeader(RequestInterface $request, array $options, array &$modify): void | |
| 58 | + private function addExpectHeader(RequestInterface $request, array $options, array &$modify) : void | |
| 59 | 59 | { |
| 60 | 60 | // Determine if the Expect header should be used |
| 61 | 61 | if ($request->hasHeader('Expect')) { |
| 62 | 62 | return; |