@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | protected function requestBodyCleanup(RequestInterface $request): string |
89 | 89 | { |
90 | 90 | $body = $request->getBody(); |
91 | - if (empty((string)$body)) { |
|
91 | + if (empty((string) $body)) { |
|
92 | 92 | return '(empty)'; |
93 | 93 | } |
94 | 94 | |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | protected function responseBodyCleanup(ResponseInterface $response): string |
155 | 155 | { |
156 | 156 | $body = $response->getBody(); |
157 | - if (empty((string)$body)) { |
|
157 | + if (empty((string) $body)) { |
|
158 | 158 | return '(empty)'; |
159 | 159 | } |
160 | 160 |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | if (empty($response)) { |
194 | 194 | return null; |
195 | 195 | } |
196 | - $responseBody = json_decode((string)$response->getBody(), true); |
|
196 | + $responseBody = json_decode((string) $response->getBody(), true); |
|
197 | 197 | if (!is_array($responseBody)) { |
198 | 198 | return null; |
199 | 199 | } |
@@ -322,13 +322,13 @@ discard block |
||
322 | 322 | $itemsWithMeta = null; |
323 | 323 | $keysAsValue = array_flip($data); |
324 | 324 | if ($keysAsValue === array_filter($keysAsValue, 'is_numeric')) { |
325 | - $items = array_map(function ($item) { |
|
325 | + $items = array_map(function($item) { |
|
326 | 326 | return [ |
327 | 327 | 'id' => $item['id'], |
328 | 328 | 'type' => $item['type'], |
329 | 329 | ]; |
330 | 330 | }, $items); |
331 | - $itemsWithMeta = array_filter($items, function ($item) { |
|
331 | + $itemsWithMeta = array_filter($items, function($item) { |
|
332 | 332 | return !empty($item['meta']); |
333 | 333 | }); |
334 | 334 | } elseif (!empty($data['meta'])) { |
@@ -455,14 +455,14 @@ discard block |
||
455 | 455 | { |
456 | 456 | $response = $this->post(sprintf('/%s', $type), json_encode($body)); |
457 | 457 | if (empty($response)) { |
458 | - throw new BEditaClientException('Invalid response from POST ' . sprintf('/%s', $type)); |
|
458 | + throw new BEditaClientException('Invalid response from POST '.sprintf('/%s', $type)); |
|
459 | 459 | } |
460 | 460 | $id = $response['data']['id']; |
461 | 461 | $data = compact('id', 'type'); |
462 | 462 | $body = compact('data'); |
463 | 463 | $response = $this->patch(sprintf('/streams/%s/relationships/object', $streamId), json_encode($body)); |
464 | 464 | if (empty($response)) { |
465 | - throw new BEditaClientException('Invalid response from PATCH ' . sprintf('/streams/%s/relationships/object', $id)); |
|
465 | + throw new BEditaClientException('Invalid response from PATCH '.sprintf('/streams/%s/relationships/object', $id)); |
|
466 | 466 | } |
467 | 467 | |
468 | 468 | return $this->getObject($data['id'], $data['type']); |
@@ -631,7 +631,7 @@ discard block |
||
631 | 631 | protected function sendRequest(string $method, string $path, ?array $query = null, ?array $headers = null, $body = null): ResponseInterface |
632 | 632 | { |
633 | 633 | $uri = $this->requestUri($path, $query); |
634 | - $headers = array_merge($this->defaultHeaders, (array)$headers); |
|
634 | + $headers = array_merge($this->defaultHeaders, (array) $headers); |
|
635 | 635 | |
636 | 636 | // set default `Content-Type` if not set and $body not empty |
637 | 637 | if (!empty($body)) { |
@@ -668,16 +668,16 @@ discard block |
||
668 | 668 | { |
669 | 669 | if (strpos($path, 'https://') !== 0 && strpos($path, 'http://') !== 0) { |
670 | 670 | if (substr($path, 0, 1) !== '/') { |
671 | - $path = '/' . $path; |
|
671 | + $path = '/'.$path; |
|
672 | 672 | } |
673 | - $path = $this->apiBaseUrl . $path; |
|
673 | + $path = $this->apiBaseUrl.$path; |
|
674 | 674 | } |
675 | 675 | $uri = new Uri($path); |
676 | 676 | |
677 | 677 | // if path contains query strings, remove them from path and add them to query filter |
678 | 678 | parse_str($uri->getQuery(), $uriQuery); |
679 | 679 | if ($query) { |
680 | - $query = array_merge((array)$uriQuery, (array)$query); |
|
680 | + $query = array_merge((array) $uriQuery, (array) $query); |
|
681 | 681 | $uri = $uri->withQuery(http_build_query($query)); |
682 | 682 | } |
683 | 683 |