Passed
Pull Request — master (#38)
by Dante
04:36 queued 02:07
created
src/Controller/Component/ApiFormatterComponent.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -26,11 +26,11 @@  discard block
 block discarded – undo
26 26
      */
27 27
     public function addObjectsStream(array $response): array
28 28
     {
29
-        $objects = (array)Hash::get($response, 'data');
29
+        $objects = (array) Hash::get($response, 'data');
30 30
         if (empty($objects)) {
31 31
             return $response;
32 32
         }
33
-        $included = (array)Hash::get($response, 'included');
33
+        $included = (array) Hash::get($response, 'included');
34 34
         if (empty($included)) {
35 35
             return $response;
36 36
         }
@@ -40,11 +40,11 @@  discard block
 block discarded – undo
40 40
             if (!Hash::check($object, 'relationships.streams.data')) {
41 41
                 continue;
42 42
             }
43
-            $relationData = (array)Hash::get($object, 'relationships.streams.data');
43
+            $relationData = (array) Hash::get($object, 'relationships.streams.data');
44 44
             $streams = $this->extractFromIncluded($included, $relationData);
45 45
             $stream = $streams[0];
46 46
             if (Hash::check($stream, 'meta.file_size')) {
47
-                $size = (int)Hash::get($stream, 'meta.file_size');
47
+                $size = (int) Hash::get($stream, 'meta.file_size');
48 48
                 $stream['meta']['file_size'] = Number::toReadableSize($size);
49 49
             }
50 50
             $object['stream'] = $stream;
@@ -62,12 +62,12 @@  discard block
 block discarded – undo
62 62
      */
63 63
     public function embedIncluded(array $response): array
64 64
     {
65
-        $data = (array)Hash::get($response, 'data');
65
+        $data = (array) Hash::get($response, 'data');
66 66
         if (empty($data)) {
67 67
             return $data;
68 68
         }
69 69
 
70
-        $included = (array)Hash::get($response, 'included');
70
+        $included = (array) Hash::get($response, 'included');
71 71
         if (empty($included)) {
72 72
             return $response;
73 73
         }
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
                 continue;
104 104
             }
105 105
 
106
-            $relation['data'] = $this->extractFromIncluded($included, (array)$relation['data']);
106
+            $relation['data'] = $this->extractFromIncluded($included, (array) $relation['data']);
107 107
         }
108 108
         unset($relation);
109 109
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
     protected function extractFromIncluded(Collection $included, array $relationshipData): array
122 122
     {
123 123
         foreach ($relationshipData as &$data) {
124
-            $data = (array)$included->firstMatch([
124
+            $data = (array) $included->firstMatch([
125 125
                 'type' => $data['type'],
126 126
                 'id' => $data['id'],
127 127
             ]);
Please login to merge, or discard this patch.