Completed
Push — master ( d79814...c030c6 )
by Stefano
15s queued 11s
created
src/BEditaClient.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.