@@ -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,7 +322,7 @@ discard block |
||
322 | 322 | |
323 | 323 | $result = $this->patch(sprintf('/%s/%s/relationships/%s', $type, $id, $relation), json_encode($body), $headers); |
324 | 324 | |
325 | - $dataWithMeta = array_filter($body, function ($item) { |
|
325 | + $dataWithMeta = array_filter($body, function($item) { |
|
326 | 326 | return !empty($item['meta']); |
327 | 327 | }); |
328 | 328 | if (!empty($bodyWithMeta)) { |
@@ -443,14 +443,14 @@ discard block |
||
443 | 443 | { |
444 | 444 | $response = $this->post(sprintf('/%s', $type), json_encode($body)); |
445 | 445 | if (empty($response)) { |
446 | - throw new BEditaClientException('Invalid response from POST ' . sprintf('/%s', $type)); |
|
446 | + throw new BEditaClientException('Invalid response from POST '.sprintf('/%s', $type)); |
|
447 | 447 | } |
448 | 448 | $id = $response['data']['id']; |
449 | 449 | $data = compact('id', 'type'); |
450 | 450 | $body = compact('data'); |
451 | 451 | $response = $this->patch(sprintf('/streams/%s/relationships/object', $streamId), json_encode($body)); |
452 | 452 | if (empty($response)) { |
453 | - throw new BEditaClientException('Invalid response from PATCH ' . sprintf('/streams/%s/relationships/object', $id)); |
|
453 | + throw new BEditaClientException('Invalid response from PATCH '.sprintf('/streams/%s/relationships/object', $id)); |
|
454 | 454 | } |
455 | 455 | |
456 | 456 | return $this->getObject($data['id'], $data['type']); |
@@ -619,7 +619,7 @@ discard block |
||
619 | 619 | protected function sendRequest(string $method, string $path, ?array $query = null, ?array $headers = null, $body = null): ResponseInterface |
620 | 620 | { |
621 | 621 | $uri = $this->requestUri($path, $query); |
622 | - $headers = array_merge($this->defaultHeaders, (array)$headers); |
|
622 | + $headers = array_merge($this->defaultHeaders, (array) $headers); |
|
623 | 623 | |
624 | 624 | // set default `Content-Type` if not set and $body not empty |
625 | 625 | if (!empty($body)) { |
@@ -656,16 +656,16 @@ discard block |
||
656 | 656 | { |
657 | 657 | if (strpos($path, 'https://') !== 0 && strpos($path, 'http://') !== 0) { |
658 | 658 | if (substr($path, 0, 1) !== '/') { |
659 | - $path = '/' . $path; |
|
659 | + $path = '/'.$path; |
|
660 | 660 | } |
661 | - $path = $this->apiBaseUrl . $path; |
|
661 | + $path = $this->apiBaseUrl.$path; |
|
662 | 662 | } |
663 | 663 | $uri = new Uri($path); |
664 | 664 | |
665 | 665 | // if path contains query strings, remove them from path and add them to query filter |
666 | 666 | parse_str($uri->getQuery(), $uriQuery); |
667 | 667 | if ($query) { |
668 | - $query = array_merge((array)$uriQuery, (array)$query); |
|
668 | + $query = array_merge((array) $uriQuery, (array) $query); |
|
669 | 669 | $uri = $uri->withQuery(http_build_query($query)); |
670 | 670 | } |
671 | 671 |