Completed
Pull Request — master (#11)
by Jodie
03:37
created
src/Relations/RelationLoader.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
      */
34 34
     protected function getRelationshipKeys(ResourceInterface $resource): array
35 35
     {
36
-        $keys = [];
36
+        $keys = [ ];
37 37
         foreach ($resource->getRelationships() as $key => $relationships) {
38 38
             if (!empty($relationships)) {
39 39
                 array_push($keys, ...$relationships);
Please login to merge, or discard this patch.
src/Transformers/TransformerResolver.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
                     (new \ReflectionClass($model))->getShortName());
56 56
                 $transformer = resolve($transformerClass);
57 57
             } catch (\Exception $e) {
58
-                throw new UnresolvedTransformerException('Unable to resolve transformer for model: '.\get_class($model),
58
+                throw new UnresolvedTransformerException('Unable to resolve transformer for model: ' . \get_class($model),
59 59
                     0, $e);
60 60
             }
61 61
         }
Please login to merge, or discard this patch.
src/Smokescreen.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
      * @param \Rexlabs\Smokescreen\Smokescreen $smokescreen
78 78
      * @param array                            $config
79 79
      */
80
-    public function __construct(\Rexlabs\Smokescreen\Smokescreen $smokescreen, array $config = [])
80
+    public function __construct(\Rexlabs\Smokescreen\Smokescreen $smokescreen, array $config = [ ])
81 81
     {
82 82
         $this->smokescreen = $smokescreen;
83 83
         $this->setConfig($config);
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
      *
92 92
      * @return static
93 93
      */
94
-    public static function make(\Rexlabs\Smokescreen\Smokescreen $smokescreen = null, array $config = [])
94
+    public static function make(\Rexlabs\Smokescreen\Smokescreen $smokescreen = null, array $config = [ ])
95 95
     {
96 96
         return new static($smokescreen ?? new \Rexlabs\Smokescreen\Smokescreen(), $config);
97 97
     }
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
         } elseif ($data instanceof Builder) {
229 229
             $data = $data->get();
230 230
         } elseif ($data instanceof Model) {
231
-            $data = new Collection([$data]);
231
+            $data = new Collection([ $data ]);
232 232
         }
233 233
 
234 234
         // Create a new collection resource
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
      */
366 366
     public function inject($key, $data)
367 367
     {
368
-        $this->injections[$key] = $data;
368
+        $this->injections[ $key ] = $data;
369 369
 
370 370
         return $this;
371 371
     }
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
         // underlying model and attempt to resolve a transformer class.
416 416
         if ($this->smokescreen->getTransformerResolver() === null) {
417 417
             $this->smokescreen->setTransformerResolver(
418
-                new TransformerResolver($this->config['transformer_namespace'] ?? 'App\\Transformers')
418
+                new TransformerResolver($this->config[ 'transformer_namespace' ] ?? 'App\\Transformers')
419 419
             );
420 420
         }
421 421
 
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
             return $this->autoParseIncludes;
468 468
         }
469 469
 
470
-        return $this->config['include_key'] ?? 'include';
470
+        return $this->config[ 'include_key' ] ?? 'include';
471 471
     }
472 472
 
473 473
     /**
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
      *
508 508
      * @see Smokescreen::toArray()
509 509
      */
510
-    public function response(int $statusCode = 200, array $headers = [], int $options = 0): JsonResponse
510
+    public function response(int $statusCode = 200, array $headers = [ ], int $options = 0): JsonResponse
511 511
     {
512 512
         // Response will only be generated once. use clearResponse() to clear.
513 513
         if ($this->response === null) {
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
      * @see Smokescreen::toArray()
536 536
      * @see Smokescreen::response()
537 537
      */
538
-    public function freshResponse(int $statusCode = 200, array $headers = [], int $options = 0): JsonResponse
538
+    public function freshResponse(int $statusCode = 200, array $headers = [ ], int $options = 0): JsonResponse
539 539
     {
540 540
         $this->clearResponse();
541 541
 
@@ -652,15 +652,15 @@  discard block
 block discarded – undo
652 652
      */
653 653
     protected function setConfig(array $config)
654 654
     {
655
-        if (!empty($config['default_serializer'])) {
656
-            $serializer = $config['default_serializer'];
655
+        if (!empty($config[ 'default_serializer' ])) {
656
+            $serializer = $config[ 'default_serializer' ];
657 657
             if (\is_string($serializer)) {
658 658
                 // Given serializer is expected to be a class path
659 659
                 // Instantiate via the container
660 660
                 $serializer = app()->make($serializer);
661 661
             }
662 662
             $this->serializeWith($serializer);
663
-            unset($config['default_serializer']);
663
+            unset($config[ 'default_serializer' ]);
664 664
         }
665 665
 
666 666
         $this->config = $config;
Please login to merge, or discard this patch.
src/Providers/ServiceProvider.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,8 +35,8 @@
 block discarded – undo
35 35
      */
36 36
     public function register()
37 37
     {
38
-        $this->app->singleton(Smokescreen::class, function () {
39
-            return new Smokescreen(new \Rexlabs\Smokescreen\Smokescreen(), config('smokescreen', []));
38
+        $this->app->singleton(Smokescreen::class, function() {
39
+            return new Smokescreen(new \Rexlabs\Smokescreen\Smokescreen(), config('smokescreen', [ ]));
40 40
         });
41 41
         $this->app->alias(Smokescreen::class, 'smokescreen');
42 42
 
Please login to merge, or discard this patch.
src/Console/MakeTransformerCommand.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -89,9 +89,9 @@
 block discarded – undo
89 89
         $modelClass = null;
90 90
 
91 91
         // If not name-spaced, get a list of classes to search in common model namespaces.
92
-        $search = str_contains('\\', $name) ? [$name] : array_map(function ($directory) use ($name) {
92
+        $search = str_contains('\\', $name) ? [ $name ] : array_map(function($directory) use ($name) {
93 93
             return $directory . '\\' . $name;
94
-        }, ['App\\Models', 'App\\Model', 'App']);
94
+        }, [ 'App\\Models', 'App\\Model', 'App' ]);
95 95
 
96 96
         // Check for a valid class.
97 97
         foreach ($search as $class) {
Please login to merge, or discard this patch.
src/Console/ModelInspector.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -66,18 +66,18 @@  discard block
 block discarded – undo
66 66
      */
67 67
     public function getIncludes(): array
68 68
     {
69
-        $list = [];
69
+        $list = [ ];
70 70
         $methods = (new ReflectionClass($this->getModelClass()))->getMethods(ReflectionMethod::IS_PUBLIC);
71
-        $declaredMethods = array_filter($methods, function (ReflectionMethod $method) {
71
+        $declaredMethods = array_filter($methods, function(ReflectionMethod $method) {
72 72
             return $method->getDeclaringClass()
73 73
                     ->getName() === $this->getModelClass();
74 74
         });
75 75
 
76 76
         foreach ($declaredMethods as $method) {
77 77
             if ($type = $this->getResourceTypeByMethodReturnType($method)) {
78
-                $list[$method->getName()] = "relation|{$type}";
78
+                $list[ $method->getName() ] = "relation|{$type}";
79 79
             } elseif ($type = $this->getResourceTypeByMethodDefinition($method)) {
80
-                $list[$method->getName()] = "relation|{$type}";
80
+                $list[ $method->getName() ] = "relation|{$type}";
81 81
             }
82 82
         }
83 83
 
@@ -95,14 +95,14 @@  discard block
 block discarded – undo
95 95
      */
96 96
     public function getDeclaredProperties() : array
97 97
     {
98
-        $list = [];
98
+        $list = [ ];
99 99
         $class = $this->getModelClass();
100 100
         $table = (new $class)->getTable();
101 101
         $columns = Schema::getColumnListing($table);
102 102
 
103 103
         foreach ($columns as $column) {
104 104
             $type = Schema::getColumnType($table, $column);
105
-            $list[$column] = $this->typesMap[$type] ?? null;
105
+            $list[ $column ] = $this->typesMap[ $type ] ?? null;
106 106
         }
107 107
 
108 108
         return $list;
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
      */
116 116
     public function getDefaultProperties(): array
117 117
     {
118
-        return [];
118
+        return [ ];
119 119
     }
120 120
 
121 121
     /**
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
      */
137 137
     protected function getResourceTypeByMethodReturnType(ReflectionMethod $method)
138 138
     {
139
-        $returnType = (string)$method->getReturnType();
139
+        $returnType = (string) $method->getReturnType();
140 140
         $namespace = 'Illuminate\Database\Eloquent\Relations';
141 141
 
142 142
         if (!starts_with($returnType, $namespace)) {
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 
146 146
         $relation = lcfirst(class_basename($returnType));
147 147
 
148
-        return $this->relationsMap[$relation] ?? null;
148
+        return $this->relationsMap[ $relation ] ?? null;
149 149
     }
150 150
 
151 151
     /**
Please login to merge, or discard this patch.