Passed
Push — master ( 4c3e72...46eb59 )
by Arthur
10:39
created
src/Foundation/Abstracts/Transformers/Transformer.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -12,9 +12,9 @@  discard block
 block discarded – undo
12 12
 
13 13
 abstract class Transformer extends JsonResource
14 14
 {
15
-    protected $include = [];
15
+    protected $include = [ ];
16 16
 
17
-    protected $available = [];
17
+    protected $available = [ ];
18 18
 
19 19
     /**
20 20
      * Resolve the resource to an array.
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
         if (isset($request->include) && is_string($request->include))
35 35
             return explode(',', $request->include);
36 36
 
37
-        return [];
37
+        return [ ];
38 38
     }
39 39
 
40 40
     protected function compileRelations(array $includedRequestRelations)
@@ -44,12 +44,12 @@  discard block
 block discarded – undo
44 44
 
45 45
     protected function includeRelations($requestedRelations)
46 46
     {
47
-        $relations = [];
47
+        $relations = [ ];
48 48
         foreach ($this->compileRelations($requestedRelations) as $relation) {
49
-            if (is_string($relation) && method_exists($this, 'transform' . ucfirst(strtolower($relation)))) {
49
+            if (is_string($relation) && method_exists($this, 'transform'.ucfirst(strtolower($relation)))) {
50 50
                 $data = null;
51 51
                 if ($this->resource !== null) {
52
-                    $method = 'transform' . ucfirst(strtolower($relation));
52
+                    $method = 'transform'.ucfirst(strtolower($relation));
53 53
                     $data = $this->$method($this->resource);
54 54
                 }
55 55
                 if ($data instanceof JsonResource) {
@@ -58,9 +58,9 @@  discard block
 block discarded – undo
58 58
                     else
59 59
                         $data->jsonSerialize();
60 60
                 }
61
-                $relations[strtolower($relation)] = $data;
61
+                $relations[ strtolower($relation) ] = $data;
62 62
             } else {
63
-                throw new \Exception('invalid relation or not relation_transform_method given in ' . get_short_class_name(static::class));
63
+                throw new \Exception('invalid relation or not relation_transform_method given in '.get_short_class_name(static::class));
64 64
             }
65 65
         }
66 66
 
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
     public function include($relations)
74 74
     {
75 75
         if (is_string($relations))
76
-            $relations = [$relations];
76
+            $relations = [ $relations ];
77 77
         $this->include = array_unique(array_merge($this->include, $relations));
78 78
         return $this;
79 79
     }
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
     public function available($relations)
85 85
     {
86 86
         if (is_string($relations))
87
-            $relations = [$relations];
87
+            $relations = [ $relations ];
88 88
         $this->available = array_unique(array_merge($this->available, $relations));
89 89
         return $this;
90 90
     }
Please login to merge, or discard this patch.
Braces   +14 added lines, -10 removed lines patch added patch discarded remove patch
@@ -31,8 +31,9 @@  discard block
 block discarded – undo
31 31
 
32 32
     protected function parseRequestIncludeParameter($request)
33 33
     {
34
-        if (isset($request->include) && is_string($request->include))
35
-            return explode(',', $request->include);
34
+        if (isset($request->include) && is_string($request->include)) {
35
+                    return explode(',', $request->include);
36
+        }
36 37
 
37 38
         return [];
38 39
     }
@@ -53,10 +54,11 @@  discard block
 block discarded – undo
53 54
                     $data = $this->$method($this->resource);
54 55
                 }
55 56
                 if ($data instanceof JsonResource) {
56
-                    if ($data->resource === null)
57
-                        $data = null;
58
-                    else
59
-                        $data->jsonSerialize();
57
+                    if ($data->resource === null) {
58
+                                            $data = null;
59
+                    } else {
60
+                                            $data->jsonSerialize();
61
+                    }
60 62
                 }
61 63
                 $relations[strtolower($relation)] = $data;
62 64
             } else {
@@ -72,8 +74,9 @@  discard block
 block discarded – undo
72 74
      */
73 75
     public function include($relations)
74 76
     {
75
-        if (is_string($relations))
76
-            $relations = [$relations];
77
+        if (is_string($relations)) {
78
+                    $relations = [$relations];
79
+        }
77 80
         $this->include = array_unique(array_merge($this->include, $relations));
78 81
         return $this;
79 82
     }
@@ -83,8 +86,9 @@  discard block
 block discarded – undo
83 86
      */
84 87
     public function available($relations)
85 88
     {
86
-        if (is_string($relations))
87
-            $relations = [$relations];
89
+        if (is_string($relations)) {
90
+                    $relations = [$relations];
91
+        }
88 92
         $this->available = array_unique(array_merge($this->available, $relations));
89 93
         return $this;
90 94
     }
Please login to merge, or discard this patch.