@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | $return = []; |
| 75 | 75 | $guards = []; |
| 76 | 76 | |
| 77 | - if (! empty($this->types)) { |
|
| 77 | + if (!empty($this->types)) { |
|
| 78 | 78 | $batch = Batch::fromTypes(...$this->types); |
| 79 | 79 | $responseBatch = $this->client->sendRequest($batch->toRequest()); |
| 80 | 80 | BatchResult::fromResponse($responseBatch)->validateBatch($batch); |
@@ -114,8 +114,8 @@ discard block |
||
| 114 | 114 | )->toRequest() |
| 115 | 115 | ); |
| 116 | 116 | |
| 117 | - if (! empty($guards)) { |
|
| 118 | - \array_walk($guards, function ($guard) use ($response) { |
|
| 117 | + if (!empty($guards)) { |
|
| 118 | + \array_walk($guards, function($guard) use ($response) { |
|
| 119 | 119 | $guard($response); |
| 120 | 120 | }); |
| 121 | 121 | } |
@@ -99,7 +99,7 @@ |
||
| 99 | 99 | |
| 100 | 100 | public function toRequest(): RequestInterface |
| 101 | 101 | { |
| 102 | - if (! empty($this->options)) { |
|
| 102 | + if (!empty($this->options)) { |
|
| 103 | 103 | return new Request( |
| 104 | 104 | $this->method, |
| 105 | 105 | Url::INDEX . $this->uri, |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | { |
| 302 | 302 | $uri = $this->uri; |
| 303 | 303 | |
| 304 | - if (! empty($this->options)) { |
|
| 304 | + if (!empty($this->options)) { |
|
| 305 | 305 | $uri .= '?' . http_build_query($this->options); |
| 306 | 306 | } |
| 307 | 307 | |
@@ -335,7 +335,7 @@ discard block |
||
| 335 | 335 | case RequestMethodInterface::METHOD_PATCH: |
| 336 | 336 | $function = $this->method === RequestMethodInterface::METHOD_PUT ? 'replace' : 'update'; |
| 337 | 337 | |
| 338 | - $keys = array_map(function ($doc) { |
|
| 338 | + $keys = array_map(function($doc) { |
|
| 339 | 339 | if (isset($doc['_key'])) { |
| 340 | 340 | return ['_key' => $doc['_key']]; |
| 341 | 341 | } |
@@ -69,7 +69,7 @@ |
||
| 69 | 69 | if (empty($params['bindVars'])) { |
| 70 | 70 | unset($params['bindVars']); |
| 71 | 71 | } |
| 72 | - if (! empty($params)) { |
|
| 72 | + if (!empty($params)) { |
|
| 73 | 73 | $params['options'] = $options; |
| 74 | 74 | } |
| 75 | 75 | return new self( |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | $key = trim($parts[0]); |
| 46 | 46 | $value = isset($parts[1]) ? trim($parts[1]) : ''; |
| 47 | 47 | |
| 48 | - if (! isset($headers[$key])) { |
|
| 48 | + if (!isset($headers[$key])) { |
|
| 49 | 49 | $headers[$key] = []; |
| 50 | 50 | } |
| 51 | 51 | $headers[$key][] = $value; |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | } |
| 86 | 86 | // TODO check key |
| 87 | 87 | $value = \json_decode($body->getContents())->{$key}; |
| 88 | - if (! \is_scalar($value)) { |
|
| 88 | + if (!\is_scalar($value)) { |
|
| 89 | 89 | $value = \json_encode($value); |
| 90 | 90 | } |
| 91 | 91 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | $customHeaders = array_merge($this->defaultHeaders, $request->getHeaders()); |
| 108 | 108 | unset($customHeaders['Connection'], $customHeaders['Content-Length']); |
| 109 | 109 | |
| 110 | - if (! isset($customHeaders['Content-Type'])) { |
|
| 110 | + if (!isset($customHeaders['Content-Type'])) { |
|
| 111 | 111 | $customHeaders['Content-Type'] = ['application/json']; |
| 112 | 112 | } |
| 113 | 113 | |
@@ -149,10 +149,10 @@ discard block |
||
| 149 | 149 | |
| 150 | 150 | $status = stream_get_meta_data($this->handle); |
| 151 | 151 | |
| 152 | - if (! empty($status['timed_out'])) { |
|
| 152 | + if (!empty($status['timed_out'])) { |
|
| 153 | 153 | throw TimeoutException::ofRequest($request); |
| 154 | 154 | } |
| 155 | - if (! $this->useKeepAlive) { |
|
| 155 | + if (!$this->useKeepAlive) { |
|
| 156 | 156 | $this->close(); |
| 157 | 157 | } |
| 158 | 158 | |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | && $method !== 'HEAD' |
| 200 | 200 | && 1 === preg_match('/content-length: (\d+)/i', $message, $matches) |
| 201 | 201 | ) { |
| 202 | - $contentLength = (int)$matches[1]; |
|
| 202 | + $contentLength = (int) $matches[1]; |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | if ($bodyLength === 0) { |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | $bodyLength = $bodyStart + $contentLength + 4; |
| 210 | 210 | } |
| 211 | 211 | } |
| 212 | - } while ($readTotal < $bodyLength && ! feof($this->handle)); |
|
| 212 | + } while ($readTotal < $bodyLength && !feof($this->handle)); |
|
| 213 | 213 | |
| 214 | 214 | return $message; |
| 215 | 215 | } |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | private function open(RequestInterface $request): void |
| 260 | 260 | { |
| 261 | 261 | if ($this->useKeepAlive && $this->handle !== null && is_resource($this->handle)) { |
| 262 | - if (! feof($this->handle)) { |
|
| 262 | + if (!feof($this->handle)) { |
|
| 263 | 263 | return; |
| 264 | 264 | } |
| 265 | 265 | |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | public function &__get($key) |
| 122 | 122 | { |
| 123 | 123 | $ret = null; |
| 124 | - $ret =& $this->offsetGet($key); |
|
| 124 | + $ret = & $this->offsetGet($key); |
|
| 125 | 125 | if (is_array($ret)) { |
| 126 | 126 | $ret = self::fromArray($ret); |
| 127 | 127 | } |
@@ -148,10 +148,10 @@ discard block |
||
| 148 | 148 | public function &offsetGet($key) |
| 149 | 149 | { |
| 150 | 150 | $ret = null; |
| 151 | - if (! $this->offsetExists($key)) { |
|
| 151 | + if (!$this->offsetExists($key)) { |
|
| 152 | 152 | return $ret; |
| 153 | 153 | } |
| 154 | - $ret =& $this->data[$key]; |
|
| 154 | + $ret = & $this->data[$key]; |
|
| 155 | 155 | if (is_array($ret)) { |
| 156 | 156 | $ret = self::fromArray($ret); |
| 157 | 157 | } |
@@ -112,14 +112,14 @@ discard block |
||
| 112 | 112 | throw new LogicException('Endpoint not specified'); |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - if (! empty($this->options[self::OPTION_AUTH_TYPE]) |
|
| 116 | - && ! in_array($this->options[self::OPTION_AUTH_TYPE], self::getSupportedAuthTypes(), true) |
|
| 115 | + if (!empty($this->options[self::OPTION_AUTH_TYPE]) |
|
| 116 | + && !in_array($this->options[self::OPTION_AUTH_TYPE], self::getSupportedAuthTypes(), true) |
|
| 117 | 117 | ) { |
| 118 | 118 | throw new LogicException('Unsupported authorization method: ' . $this->options[self::OPTION_AUTH_TYPE]); |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - if (! empty($this->options[self::OPTION_CONNECTION]) |
|
| 122 | - && ! in_array($this->options[self::OPTION_CONNECTION], self::getSupportedConnectionTypes(), true) |
|
| 121 | + if (!empty($this->options[self::OPTION_CONNECTION]) |
|
| 122 | + && !in_array($this->options[self::OPTION_CONNECTION], self::getSupportedConnectionTypes(), true) |
|
| 123 | 123 | ) { |
| 124 | 124 | throw new LogicException('Unsupported connection value: ' . $this->options[self::OPTION_CONNECTION]); |
| 125 | 125 | } |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | */ |
| 158 | 158 | public function offsetGet($offset) |
| 159 | 159 | { |
| 160 | - if (! array_key_exists($offset, $this->options)) { |
|
| 160 | + if (!array_key_exists($offset, $this->options)) { |
|
| 161 | 161 | throw new LogicException('Invalid option ' . $offset); |
| 162 | 162 | } |
| 163 | 163 | |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | */ |
| 157 | 157 | public function __construct(ClientInterface $client, RequestInterface $request, array $options = []) |
| 158 | 158 | { |
| 159 | - if (! isset($options[self::ENTRY_TYPE])) { |
|
| 159 | + if (!isset($options[self::ENTRY_TYPE])) { |
|
| 160 | 160 | $options[self::ENTRY_TYPE] = self::ENTRY_TYPE_JSON; |
| 161 | 161 | } |
| 162 | 162 | |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | |
| 241 | 241 | switch ($this->options[self::ENTRY_TYPE]) { |
| 242 | 242 | case self::ENTRY_TYPE_OBJECT: |
| 243 | - return (object)$this->data->toArray(); |
|
| 243 | + return (object) $this->data->toArray(); |
|
| 244 | 244 | break; |
| 245 | 245 | case self::ENTRY_TYPE_ARRAY: |
| 246 | 246 | return $this->data->toArray(); |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | { |
| 297 | 297 | switch ($this->options[self::ENTRY_TYPE]) { |
| 298 | 298 | case self::ENTRY_TYPE_OBJECT: |
| 299 | - return (object)$this->data[$this->position]->toArray(); |
|
| 299 | + return (object) $this->data[$this->position]->toArray(); |
|
| 300 | 300 | case self::ENTRY_TYPE_ARRAY: |
| 301 | 301 | return $this->data[$this->position]->toArray(); |
| 302 | 302 | case self::ENTRY_TYPE_JSON: |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | return true; |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | - if (! $this->hasMore || $this->id === null) { |
|
| 329 | + if (!$this->hasMore || $this->id === null) { |
|
| 330 | 330 | return false; |
| 331 | 331 | } |
| 332 | 332 | |