← All changes
|
includes/sdk/google/guzzlehttp/psr7/src/Request.php
+16
-16
1.1.1
→
1.4.2
View file →
| @@ -1,13 +1,13 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | declare (strict_types=1); |
| 4 | -namespace Dudlewebs\WPMCS\GuzzleHttp\Psr7; | |
| 4 | +namespace Dudlewebs\WPMCS\GCP\GuzzleHttp\Psr7; | |
| 5 | 5 | |
| 6 | 6 | use InvalidArgumentException; |
| 7 | -use Dudlewebs\WPMCS\Psr\Http\Message\RequestInterface; | |
| 8 | -use Dudlewebs\WPMCS\Psr\Http\Message\StreamInterface; | |
| 9 | -use Dudlewebs\WPMCS\Psr\Http\Message\UriInterface; | |
| 7 | +use Dudlewebs\WPMCS\GCP\Psr\Http\Message\RequestInterface; | |
| 8 | +use Dudlewebs\WPMCS\GCP\Psr\Http\Message\StreamInterface; | |
| 9 | +use Dudlewebs\WPMCS\GCP\Psr\Http\Message\UriInterface; | |
| 10 | 10 | /** |
| 11 | 11 | * PSR-7 request implementation. |
| 12 | 12 | */ |
| 13 | 13 | class Request implements RequestInterface |
| @@ -31,9 +31,9 @@ | ||
| 31 | 31 | $this->assertMethod($method); |
| 32 | 32 | if (!$uri instanceof UriInterface) { |
| 33 | 33 | $uri = new Uri($uri); |
| 34 | 34 | } |
| 35 | - $this->method = strtoupper($method); | |
| 35 | + $this->method = \strtoupper($method); | |
| 36 | 36 | $this->uri = $uri; |
| 37 | 37 | $this->setHeaders($headers); |
| 38 | 38 | $this->protocol = $version; |
| 39 | 39 | if (!isset($this->headerNames['host'])) { |
| @@ -42,9 +42,9 @@ | ||
| 42 | 42 | if ($body !== '' && $body !== null) { |
| 43 | 43 | $this->stream = Utils::streamFor($body); |
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | - public function getRequestTarget(): string | |
| 46 | + public function getRequestTarget() : string | |
| 47 | 47 | { |
| 48 | 48 | if ($this->requestTarget !== null) { |
| 49 | 49 | return $this->requestTarget; |
| 50 | 50 | } |
| @@ -56,11 +56,11 @@ | ||
| 56 | 56 | $target .= '?' . $this->uri->getQuery(); |
| 57 | 57 | } |
| 58 | 58 | return $target; |
| 59 | 59 | } |
| 60 | - public function withRequestTarget($requestTarget): RequestInterface | |
| 60 | + public function withRequestTarget($requestTarget) : RequestInterface | |
| 61 | 61 | { |
| 62 | - if (preg_match('#\s#', $requestTarget)) { | |
| 62 | + if (\preg_match('#\\s#', $requestTarget)) { | |
| 63 | 63 | throw new InvalidArgumentException('Invalid request target provided; cannot contain whitespace'); |
| 64 | 64 | } |
| 65 | 65 | $new = clone $this; |
| 66 | 66 | $new->requestTarget = $requestTarget; |
| @@ -65,24 +65,24 @@ | ||
| 65 | 65 | $new = clone $this; |
| 66 | 66 | $new->requestTarget = $requestTarget; |
| 67 | 67 | return $new; |
| 68 | 68 | } |
| 69 | - public function getMethod(): string | |
| 69 | + public function getMethod() : string | |
| 70 | 70 | { |
| 71 | 71 | return $this->method; |
| 72 | 72 | } |
| 73 | - public function withMethod($method): RequestInterface | |
| 73 | + public function withMethod($method) : RequestInterface | |
| 74 | 74 | { |
| 75 | 75 | $this->assertMethod($method); |
| 76 | 76 | $new = clone $this; |
| 77 | - $new->method = strtoupper($method); | |
| 77 | + $new->method = \strtoupper($method); | |
| 78 | 78 | return $new; |
| 79 | 79 | } |
| 80 | - public function getUri(): UriInterface | |
| 80 | + public function getUri() : UriInterface | |
| 81 | 81 | { |
| 82 | 82 | return $this->uri; |
| 83 | 83 | } |
| 84 | - public function withUri(UriInterface $uri, $preserveHost = \false): RequestInterface | |
| 84 | + public function withUri(UriInterface $uri, $preserveHost = \false) : RequestInterface | |
| 85 | 85 | { |
| 86 | 86 | if ($uri === $this->uri) { |
| 87 | 87 | return $this; |
| 88 | 88 | } |
| @@ -92,9 +92,9 @@ | ||
| 92 | 92 | $new->updateHostFromUri(); |
| 93 | 93 | } |
| 94 | 94 | return $new; |
| 95 | 95 | } |
| 96 | - private function updateHostFromUri(): void | |
| 96 | + private function updateHostFromUri() : void | |
| 97 | 97 | { |
| 98 | 98 | $host = $this->uri->getHost(); |
| 99 | 99 | if ($host == '') { |
| 100 | 100 | return; |
| @@ -114,11 +114,11 @@ | ||
| 114 | 114 | } |
| 115 | 115 | /** |
| 116 | 116 | * @param mixed $method |
| 117 | 117 | */ |
| 118 | - private function assertMethod($method): void | |
| 118 | + private function assertMethod($method) : void | |
| 119 | 119 | { |
| 120 | - if (!is_string($method) || $method === '') { | |
| 120 | + if (!\is_string($method) || $method === '') { | |
| 121 | 121 | throw new InvalidArgumentException('Method must be a non-empty string.'); |
| 122 | 122 | } |
| 123 | 123 | } |
| 124 | 124 | } |