@@ -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 | } |
@@ -317,13 +317,13 @@ discard block |
||
317 | 317 | $items = $data; |
318 | 318 | $withMeta = null; |
319 | 319 | if (!empty($data[0])) { |
320 | - $items = array_map(function ($item) { |
|
320 | + $items = array_map(function($item) { |
|
321 | 321 | return [ |
322 | 322 | 'id' => $item['id'], |
323 | 323 | 'type' => $item['type'], |
324 | 324 | ]; |
325 | 325 | }, $data); |
326 | - $withMeta = array_filter($data, function ($item) { |
|
326 | + $withMeta = array_filter($data, function($item) { |
|
327 | 327 | return !empty($item['meta']); |
328 | 328 | }); |
329 | 329 | } elseif (!empty($data['meta'])) { |
@@ -467,14 +467,14 @@ discard block |
||
467 | 467 | { |
468 | 468 | $response = $this->post(sprintf('/%s', $type), json_encode($body)); |
469 | 469 | if (empty($response)) { |
470 | - throw new BEditaClientException('Invalid response from POST ' . sprintf('/%s', $type)); |
|
470 | + throw new BEditaClientException('Invalid response from POST '.sprintf('/%s', $type)); |
|
471 | 471 | } |
472 | 472 | $id = $response['data']['id']; |
473 | 473 | $data = compact('id', 'type'); |
474 | 474 | $body = compact('data'); |
475 | 475 | $response = $this->patch(sprintf('/streams/%s/relationships/object', $streamId), json_encode($body)); |
476 | 476 | if (empty($response)) { |
477 | - throw new BEditaClientException('Invalid response from PATCH ' . sprintf('/streams/%s/relationships/object', $id)); |
|
477 | + throw new BEditaClientException('Invalid response from PATCH '.sprintf('/streams/%s/relationships/object', $id)); |
|
478 | 478 | } |
479 | 479 | |
480 | 480 | return $this->getObject($data['id'], $data['type']); |
@@ -643,7 +643,7 @@ discard block |
||
643 | 643 | protected function sendRequest(string $method, string $path, ?array $query = null, ?array $headers = null, $body = null): ResponseInterface |
644 | 644 | { |
645 | 645 | $uri = $this->requestUri($path, $query); |
646 | - $headers = array_merge($this->defaultHeaders, (array)$headers); |
|
646 | + $headers = array_merge($this->defaultHeaders, (array) $headers); |
|
647 | 647 | |
648 | 648 | // set default `Content-Type` if not set and $body not empty |
649 | 649 | if (!empty($body)) { |
@@ -680,16 +680,16 @@ discard block |
||
680 | 680 | { |
681 | 681 | if (strpos($path, 'https://') !== 0 && strpos($path, 'http://') !== 0) { |
682 | 682 | if (substr($path, 0, 1) !== '/') { |
683 | - $path = '/' . $path; |
|
683 | + $path = '/'.$path; |
|
684 | 684 | } |
685 | - $path = $this->apiBaseUrl . $path; |
|
685 | + $path = $this->apiBaseUrl.$path; |
|
686 | 686 | } |
687 | 687 | $uri = new Uri($path); |
688 | 688 | |
689 | 689 | // if path contains query strings, remove them from path and add them to query filter |
690 | 690 | parse_str($uri->getQuery(), $uriQuery); |
691 | 691 | if ($query) { |
692 | - $query = array_merge((array)$uriQuery, (array)$query); |
|
692 | + $query = array_merge((array) $uriQuery, (array) $query); |
|
693 | 693 | $uri = $uri->withQuery(http_build_query($query)); |
694 | 694 | } |
695 | 695 |