@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | */ |
| 121 | 121 | public function eof() |
| 122 | 122 | { |
| 123 | - return ! $this->source; |
|
| 123 | + return !$this->source; |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | /** |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | public function getContents() |
| 197 | 197 | { |
| 198 | 198 | $result = ''; |
| 199 | - while (! $this->eof()) { |
|
| 199 | + while (!$this->eof()) { |
|
| 200 | 200 | $result .= $this->read(1000000); |
| 201 | 201 | } |
| 202 | 202 | |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | */ |
| 209 | 209 | public function getMetadata($key = null) |
| 210 | 210 | { |
| 211 | - if (! $key) { |
|
| 211 | + if (!$key) { |
|
| 212 | 212 | return $this->metadata; |
| 213 | 213 | } |
| 214 | 214 | |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | public function __construct($stream, $options = []) |
| 83 | 83 | { |
| 84 | - if (! is_resource($stream)) { |
|
| 84 | + if (!is_resource($stream)) { |
|
| 85 | 85 | throw new \InvalidArgumentException('Stream must be a resource'); |
| 86 | 86 | } |
| 87 | 87 | |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | */ |
| 127 | 127 | public function getContents() |
| 128 | 128 | { |
| 129 | - if (! isset($this->stream)) { |
|
| 129 | + if (!isset($this->stream)) { |
|
| 130 | 130 | throw new \RuntimeException('Stream is detached'); |
| 131 | 131 | } |
| 132 | 132 | |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | */ |
| 158 | 158 | public function detach() |
| 159 | 159 | { |
| 160 | - if (! isset($this->stream)) { |
|
| 160 | + if (!isset($this->stream)) { |
|
| 161 | 161 | return null; |
| 162 | 162 | } |
| 163 | 163 | |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | return $this->size; |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - if (! isset($this->stream)) { |
|
| 181 | + if (!isset($this->stream)) { |
|
| 182 | 182 | return null; |
| 183 | 183 | } |
| 184 | 184 | |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | */ |
| 226 | 226 | public function eof() |
| 227 | 227 | { |
| 228 | - if (! isset($this->stream)) { |
|
| 228 | + if (!isset($this->stream)) { |
|
| 229 | 229 | throw new \RuntimeException('Stream is detached'); |
| 230 | 230 | } |
| 231 | 231 | |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | */ |
| 238 | 238 | public function tell() |
| 239 | 239 | { |
| 240 | - if (! isset($this->stream)) { |
|
| 240 | + if (!isset($this->stream)) { |
|
| 241 | 241 | throw new \RuntimeException('Stream is detached'); |
| 242 | 242 | } |
| 243 | 243 | |
@@ -263,10 +263,10 @@ discard block |
||
| 263 | 263 | */ |
| 264 | 264 | public function seek($offset, $whence = SEEK_SET): void |
| 265 | 265 | { |
| 266 | - if (! isset($this->stream)) { |
|
| 266 | + if (!isset($this->stream)) { |
|
| 267 | 267 | throw new \RuntimeException('Stream is detached'); |
| 268 | 268 | } |
| 269 | - if (! $this->seekable) { |
|
| 269 | + if (!$this->seekable) { |
|
| 270 | 270 | throw new \RuntimeException('Stream is not seekable'); |
| 271 | 271 | } |
| 272 | 272 | if (fseek($this->stream, $offset, $whence) === -1) { |
@@ -280,10 +280,10 @@ discard block |
||
| 280 | 280 | */ |
| 281 | 281 | public function read($length) |
| 282 | 282 | { |
| 283 | - if (! isset($this->stream)) { |
|
| 283 | + if (!isset($this->stream)) { |
|
| 284 | 284 | throw new \RuntimeException('Stream is detached'); |
| 285 | 285 | } |
| 286 | - if (! $this->readable) { |
|
| 286 | + if (!$this->readable) { |
|
| 287 | 287 | throw new \RuntimeException('Cannot read from non-readable stream'); |
| 288 | 288 | } |
| 289 | 289 | if ($length < 0) { |
@@ -307,10 +307,10 @@ discard block |
||
| 307 | 307 | */ |
| 308 | 308 | public function write($string) |
| 309 | 309 | { |
| 310 | - if (! isset($this->stream)) { |
|
| 310 | + if (!isset($this->stream)) { |
|
| 311 | 311 | throw new \RuntimeException('Stream is detached'); |
| 312 | 312 | } |
| 313 | - if (! $this->writable) { |
|
| 313 | + if (!$this->writable) { |
|
| 314 | 314 | throw new \RuntimeException('Cannot write to a non-writable stream'); |
| 315 | 315 | } |
| 316 | 316 | |
@@ -330,9 +330,9 @@ discard block |
||
| 330 | 330 | */ |
| 331 | 331 | public function getMetadata($key = null) |
| 332 | 332 | { |
| 333 | - if (! isset($this->stream)) { |
|
| 333 | + if (!isset($this->stream)) { |
|
| 334 | 334 | return $key ? null : []; |
| 335 | - } elseif (! $key) { |
|
| 335 | + } elseif (!$key) { |
|
| 336 | 336 | return $this->customMetadata + stream_get_meta_data($this->stream); |
| 337 | 337 | } elseif (isset($this->customMetadata[$key])) { |
| 338 | 338 | return $this->customMetadata[$key]; |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | { |
| 76 | 76 | $lower = strtolower($name); |
| 77 | 77 | |
| 78 | - if (! isset($this->headerNames[$lower])) { |
|
| 78 | + if (!isset($this->headerNames[$lower])) { |
|
| 79 | 79 | return []; |
| 80 | 80 | } |
| 81 | 81 | |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | */ |
| 96 | 96 | public function withHeader($header, $value) |
| 97 | 97 | { |
| 98 | - if (! is_array($value)) { |
|
| 98 | + if (!is_array($value)) { |
|
| 99 | 99 | $value = [$value]; |
| 100 | 100 | } |
| 101 | 101 | $value = $this->trimHeaderValues($value); |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | public function withAddedHeader($header, $value) |
| 116 | 116 | { |
| 117 | - if (! is_array($value)) { |
|
| 117 | + if (!is_array($value)) { |
|
| 118 | 118 | $value = [$value]; |
| 119 | 119 | } |
| 120 | 120 | $value = $this->trimHeaderValues($value); |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | public function withoutHeader($header) |
| 137 | 137 | { |
| 138 | 138 | $normalized = strtolower($header); |
| 139 | - if (! isset($this->headerNames[$normalized])) { |
|
| 139 | + if (!isset($this->headerNames[$normalized])) { |
|
| 140 | 140 | return $this; |
| 141 | 141 | } |
| 142 | 142 | $header = $this->headerNames[$normalized]; |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | */ |
| 151 | 151 | public function getBody() |
| 152 | 152 | { |
| 153 | - if (! $this->stream) { |
|
| 153 | + if (!$this->stream) { |
|
| 154 | 154 | $this->stream = \One\stream_for(''); |
| 155 | 155 | } |
| 156 | 156 | return $this->stream; |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | { |
| 177 | 177 | $this->headerNames = $this->headers = []; |
| 178 | 178 | foreach ($headers as $header => $value) { |
| 179 | - if (! is_array($value)) { |
|
| 179 | + if (!is_array($value)) { |
|
| 180 | 180 | $value = [$value]; |
| 181 | 181 | } |
| 182 | 182 | $value = $this->trimHeaderValues($value); |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | */ |
| 158 | 158 | public function getPort() |
| 159 | 159 | { |
| 160 | - return $this->port !== null && ! $this->hasStandardPort() ? $this->port : null; |
|
| 160 | + return $this->port !== null && !$this->hasStandardPort() ? $this->port : null; |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | /** |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | ]; |
| 308 | 308 | |
| 309 | 309 | $scheme = str_replace('://', '', strtolower($scheme)); |
| 310 | - if (! isset($valid[$scheme])) { |
|
| 310 | + if (!isset($valid[$scheme])) { |
|
| 311 | 311 | throw new InvalidArgumentException('Uri scheme must be one of: "", "https", "http"'); |
| 312 | 312 | } |
| 313 | 313 | |
@@ -154,7 +154,7 @@ |
||
| 154 | 154 | public function getArticle(string $idArticle): string |
| 155 | 155 | { |
| 156 | 156 | return $this->get( |
| 157 | - self::ARTICLE_CHECK_ENDPOINT . "/${idArticle}" |
|
| 157 | + self::ARTICLE_CHECK_ENDPOINT . "/${idarticle}" |
|
| 158 | 158 | ); |
| 159 | 159 | } |
| 160 | 160 | |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | ]; |
| 220 | 220 | |
| 221 | 221 | return $this->get( |
| 222 | - self::PUBLISHER_ENDPOINT.'/'. $this->clientId .'/?'. http_build_query($params) |
|
| 222 | + self::PUBLISHER_ENDPOINT . '/' . $this->clientId . '/?' . http_build_query($params) |
|
| 223 | 223 | ); |
| 224 | 224 | } |
| 225 | 225 | |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | { |
| 231 | 231 | $articleOnRest = $this->getArticle($idArticle); |
| 232 | 232 | |
| 233 | - if (! empty($articleOnRest)) { |
|
| 233 | + if (!empty($articleOnRest)) { |
|
| 234 | 234 | $articleOnRest = json_decode($articleOnRest, true); |
| 235 | 235 | |
| 236 | 236 | if (isset($articleOnRest['data'])) { |
@@ -486,7 +486,7 @@ discard block |
||
| 486 | 486 | throw new \Exception('Access token request return empty response'); |
| 487 | 487 | } |
| 488 | 488 | |
| 489 | - if (! empty($this->tokenSaver)) { |
|
| 489 | + if (!empty($this->tokenSaver)) { |
|
| 490 | 490 | $this->getTokenSaver()( |
| 491 | 491 | $token['access_token'] |
| 492 | 492 | ); |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | return stream_for((string) $resource, $options); |
| 107 | 107 | } |
| 108 | 108 | return new PumpStream(function () use ($resource) { |
| 109 | - if (! $resource->valid()) { |
|
| 109 | + if (!$resource->valid()) { |
|
| 110 | 110 | return false; |
| 111 | 111 | } |
| 112 | 112 | $result = $resource->current(); |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | { |
| 138 | 138 | $buffer = ''; |
| 139 | 139 | if ($maxLen === -1) { |
| 140 | - while (! $stream->eof()) { |
|
| 140 | + while (!$stream->eof()) { |
|
| 141 | 141 | $buf = $stream->read(1048576); |
| 142 | 142 | // Using a loose equality here to match on '' and false. |
| 143 | 143 | if ($buf === null) { |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | $len = 0; |
| 152 | - while (! $stream->eof() && $len < $maxLen) { |
|
| 152 | + while (!$stream->eof() && $len < $maxLen) { |
|
| 153 | 153 | $buf = $stream->read($maxLen - $len); |
| 154 | 154 | // Using a loose equality here to match on '' and false. |
| 155 | 155 | if ($buf === null) { |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | { |
| 121 | 121 | $props = json_decode((string) $stream); |
| 122 | 122 | |
| 123 | - if (! is_array($props)) { |
|
| 123 | + if (!is_array($props)) { |
|
| 124 | 124 | throw new \InvalidArgumentException('argument must be json formated, and could be decoded.'); |
| 125 | 125 | } |
| 126 | 126 | |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | */ |
| 145 | 145 | public function set(string $key, $value): self |
| 146 | 146 | { |
| 147 | - if (! isset($this->props[$key])) { |
|
| 147 | + if (!isset($this->props[$key])) { |
|
| 148 | 148 | throw new \Exception('Cannot add new property from set. Use add()'); |
| 149 | 149 | } |
| 150 | 150 | |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | */ |
| 161 | 161 | public function add(string $key, $value): self |
| 162 | 162 | { |
| 163 | - if (! array_key_exists($key, $this->props)) { |
|
| 163 | + if (!array_key_exists($key, $this->props)) { |
|
| 164 | 164 | return $this->addNew($key, $value); |
| 165 | 165 | } |
| 166 | 166 | |
@@ -52,7 +52,7 @@ |
||
| 52 | 52 | */ |
| 53 | 53 | private function fillSource($source, $photo): string |
| 54 | 54 | { |
| 55 | - if (! empty($source)) { |
|
| 55 | + if (!empty($source)) { |
|
| 56 | 56 | return $this->filterUriInstance($source); |
| 57 | 57 | } |
| 58 | 58 | |
@@ -37,14 +37,14 @@ discard block |
||
| 37 | 37 | $body = null, |
| 38 | 38 | $version = '1.1' |
| 39 | 39 | ) { |
| 40 | - if (! ($uri instanceof \Psr\Http\Message\UriInterface)) { |
|
| 40 | + if (!($uri instanceof \Psr\Http\Message\UriInterface)) { |
|
| 41 | 41 | $uri = \One\createUriFromString($uri); |
| 42 | 42 | } |
| 43 | 43 | $this->method = strtoupper($method); |
| 44 | 44 | $this->uri = $uri; |
| 45 | 45 | $this->setHeaders($headers); |
| 46 | 46 | $this->protocol = $version; |
| 47 | - if (! $this->hasHeader('Host')) { |
|
| 47 | + if (!$this->hasHeader('Host')) { |
|
| 48 | 48 | $this->updateHostFromUri(); |
| 49 | 49 | } |
| 50 | 50 | if ($body !== '' && $body !== null) { |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | */ |
| 58 | 58 | public function getRequestTarget() |
| 59 | 59 | { |
| 60 | - if (! empty($this->requestTarget)) { |
|
| 60 | + if (!empty($this->requestTarget)) { |
|
| 61 | 61 | return $this->requestTarget; |
| 62 | 62 | } |
| 63 | 63 | $target = $this->uri->getPath(); |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | } |
| 122 | 122 | $new = clone $this; |
| 123 | 123 | $new->uri = $uri; |
| 124 | - if (! $preserveHost) { |
|
| 124 | + if (!$preserveHost) { |
|
| 125 | 125 | $new->updateHostFromUri(); |
| 126 | 126 | } |
| 127 | 127 | return $new; |