@@ -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 | } |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | */ |
| 319 | 319 | public function replaceRelated($id, string $type, string $relation, array $data, ?array $headers = null): ?array |
| 320 | 320 | { |
| 321 | - $items = array_map(function ($item) { |
|
| 321 | + $items = array_map(function($item) { |
|
| 322 | 322 | return [ |
| 323 | 323 | 'id' => $item['id'], |
| 324 | 324 | 'type' => $item['type'], |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | }, $data); |
| 327 | 327 | $result = $this->patch(sprintf('/%s/%s/relationships/%s', $type, $id, $relation), json_encode(['data' => $items]), $headers); |
| 328 | 328 | |
| 329 | - $dataWithMeta = array_filter($data, function ($item) { |
|
| 329 | + $dataWithMeta = array_filter($data, function($item) { |
|
| 330 | 330 | return !empty($item['meta']); |
| 331 | 331 | }); |
| 332 | 332 | if (!empty($dataWithMeta)) { |
@@ -447,14 +447,14 @@ discard block |
||
| 447 | 447 | { |
| 448 | 448 | $response = $this->post(sprintf('/%s', $type), json_encode($body)); |
| 449 | 449 | if (empty($response)) { |
| 450 | - throw new BEditaClientException('Invalid response from POST ' . sprintf('/%s', $type)); |
|
| 450 | + throw new BEditaClientException('Invalid response from POST '.sprintf('/%s', $type)); |
|
| 451 | 451 | } |
| 452 | 452 | $id = $response['data']['id']; |
| 453 | 453 | $data = compact('id', 'type'); |
| 454 | 454 | $body = compact('data'); |
| 455 | 455 | $response = $this->patch(sprintf('/streams/%s/relationships/object', $streamId), json_encode($body)); |
| 456 | 456 | if (empty($response)) { |
| 457 | - throw new BEditaClientException('Invalid response from PATCH ' . sprintf('/streams/%s/relationships/object', $id)); |
|
| 457 | + throw new BEditaClientException('Invalid response from PATCH '.sprintf('/streams/%s/relationships/object', $id)); |
|
| 458 | 458 | } |
| 459 | 459 | |
| 460 | 460 | return $this->getObject($data['id'], $data['type']); |
@@ -623,7 +623,7 @@ discard block |
||
| 623 | 623 | protected function sendRequest(string $method, string $path, ?array $query = null, ?array $headers = null, $body = null): ResponseInterface |
| 624 | 624 | { |
| 625 | 625 | $uri = $this->requestUri($path, $query); |
| 626 | - $headers = array_merge($this->defaultHeaders, (array)$headers); |
|
| 626 | + $headers = array_merge($this->defaultHeaders, (array) $headers); |
|
| 627 | 627 | |
| 628 | 628 | // set default `Content-Type` if not set and $body not empty |
| 629 | 629 | if (!empty($body)) { |
@@ -660,16 +660,16 @@ discard block |
||
| 660 | 660 | { |
| 661 | 661 | if (strpos($path, 'https://') !== 0 && strpos($path, 'http://') !== 0) { |
| 662 | 662 | if (substr($path, 0, 1) !== '/') { |
| 663 | - $path = '/' . $path; |
|
| 663 | + $path = '/'.$path; |
|
| 664 | 664 | } |
| 665 | - $path = $this->apiBaseUrl . $path; |
|
| 665 | + $path = $this->apiBaseUrl.$path; |
|
| 666 | 666 | } |
| 667 | 667 | $uri = new Uri($path); |
| 668 | 668 | |
| 669 | 669 | // if path contains query strings, remove them from path and add them to query filter |
| 670 | 670 | parse_str($uri->getQuery(), $uriQuery); |
| 671 | 671 | if ($query) { |
| 672 | - $query = array_merge((array)$uriQuery, (array)$query); |
|
| 672 | + $query = array_merge((array) $uriQuery, (array) $query); |
|
| 673 | 673 | $uri = $uri->withQuery(http_build_query($query)); |
| 674 | 674 | } |
| 675 | 675 | |