@@ -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 | } |
@@ -321,13 +321,13 @@ discard block |
||
321 | 321 | $items = $data; |
322 | 322 | $itemsWithMeta = null; |
323 | 323 | if (!empty($data[0])) { |
324 | - $items = array_map(function ($item) { |
|
324 | + $items = array_map(function($item) { |
|
325 | 325 | return [ |
326 | 326 | 'id' => $item['id'], |
327 | 327 | 'type' => $item['type'], |
328 | 328 | ]; |
329 | 329 | }, $items); |
330 | - $itemsWithMeta = array_filter($data, function ($item) { |
|
330 | + $itemsWithMeta = array_filter($data, function($item) { |
|
331 | 331 | return !empty($item['meta']); |
332 | 332 | }); |
333 | 333 | } elseif (!empty($data['meta'])) { |
@@ -454,14 +454,14 @@ discard block |
||
454 | 454 | { |
455 | 455 | $response = $this->post(sprintf('/%s', $type), json_encode($body)); |
456 | 456 | if (empty($response)) { |
457 | - throw new BEditaClientException('Invalid response from POST ' . sprintf('/%s', $type)); |
|
457 | + throw new BEditaClientException('Invalid response from POST '.sprintf('/%s', $type)); |
|
458 | 458 | } |
459 | 459 | $id = $response['data']['id']; |
460 | 460 | $data = compact('id', 'type'); |
461 | 461 | $body = compact('data'); |
462 | 462 | $response = $this->patch(sprintf('/streams/%s/relationships/object', $streamId), json_encode($body)); |
463 | 463 | if (empty($response)) { |
464 | - throw new BEditaClientException('Invalid response from PATCH ' . sprintf('/streams/%s/relationships/object', $id)); |
|
464 | + throw new BEditaClientException('Invalid response from PATCH '.sprintf('/streams/%s/relationships/object', $id)); |
|
465 | 465 | } |
466 | 466 | |
467 | 467 | return $this->getObject($data['id'], $data['type']); |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | protected function sendRequest(string $method, string $path, ?array $query = null, ?array $headers = null, $body = null): ResponseInterface |
631 | 631 | { |
632 | 632 | $uri = $this->requestUri($path, $query); |
633 | - $headers = array_merge($this->defaultHeaders, (array)$headers); |
|
633 | + $headers = array_merge($this->defaultHeaders, (array) $headers); |
|
634 | 634 | |
635 | 635 | // set default `Content-Type` if not set and $body not empty |
636 | 636 | if (!empty($body)) { |
@@ -667,16 +667,16 @@ discard block |
||
667 | 667 | { |
668 | 668 | if (strpos($path, 'https://') !== 0 && strpos($path, 'http://') !== 0) { |
669 | 669 | if (substr($path, 0, 1) !== '/') { |
670 | - $path = '/' . $path; |
|
670 | + $path = '/'.$path; |
|
671 | 671 | } |
672 | - $path = $this->apiBaseUrl . $path; |
|
672 | + $path = $this->apiBaseUrl.$path; |
|
673 | 673 | } |
674 | 674 | $uri = new Uri($path); |
675 | 675 | |
676 | 676 | // if path contains query strings, remove them from path and add them to query filter |
677 | 677 | parse_str($uri->getQuery(), $uriQuery); |
678 | 678 | if ($query) { |
679 | - $query = array_merge((array)$uriQuery, (array)$query); |
|
679 | + $query = array_merge((array) $uriQuery, (array) $query); |
|
680 | 680 | $uri = $uri->withQuery(http_build_query($query)); |
681 | 681 | } |
682 | 682 |