Passed
Push — master ( c13b73...f2713c )
by Arthur
05:06
created
src/Foundation/Abstracts/Transformers/Transformer.php 2 patches
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.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -13,9 +13,9 @@  discard block
 block discarded – undo
13 13
 
14 14
 abstract class Transformer extends JsonResource implements Transformable
15 15
 {
16
-    protected $include = [];
16
+    protected $include = [ ];
17 17
 
18
-    protected $available = [];
18
+    protected $available = [ ];
19 19
 
20 20
     /**
21 21
      * 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,13 +44,13 @@  discard block
 block discarded – undo
44 44
 
45 45
     public function getIncludedRelations($request)
46 46
     {
47
-        $requestedRelations= $this->parseRequestIncludeParameter($request);
48
-        $relations = [];
47
+        $requestedRelations = $this->parseRequestIncludeParameter($request);
48
+        $relations = [ ];
49 49
         foreach ($this->compileRelations($requestedRelations) as $relation) {
50
-            if (is_string($relation) && method_exists($this, 'transform' . ucfirst(strtolower($relation)))) {
50
+            if (is_string($relation) && method_exists($this, 'transform'.ucfirst(strtolower($relation)))) {
51 51
                 $data = null;
52 52
                 if ($this->resource !== null) {
53
-                    $method = 'transform' . ucfirst(strtolower($relation));
53
+                    $method = 'transform'.ucfirst(strtolower($relation));
54 54
                     $data = $this->$method($this->resource);
55 55
                 }
56 56
                 if ($data instanceof JsonResource) {
@@ -59,9 +59,9 @@  discard block
 block discarded – undo
59 59
                     else
60 60
                         $data->jsonSerialize();
61 61
                 }
62
-                $relations[strtolower($relation)] = $data;
62
+                $relations[ strtolower($relation) ] = $data;
63 63
             } else {
64
-                throw new \Exception('invalid relation or not relation_transform_method given in ' . get_short_class_name(static::class));
64
+                throw new \Exception('invalid relation or not relation_transform_method given in '.get_short_class_name(static::class));
65 65
             }
66 66
         }
67 67
 
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
     public function include($relations)
75 75
     {
76 76
         if (is_string($relations))
77
-            $relations = [$relations];
77
+            $relations = [ $relations ];
78 78
         $this->include = array_unique(array_merge($this->include, $relations));
79 79
         return $this;
80 80
     }
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
     public function available($relations)
86 86
     {
87 87
         if (is_string($relations))
88
-            $relations = [$relations];
88
+            $relations = [ $relations ];
89 89
         $this->available = array_unique(array_merge($this->available, $relations));
90 90
         return $this;
91 91
     }
Please login to merge, or discard this patch.
src/Foundation/Providers/BootstrapServiceProvider.php 2 patches
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -78,25 +78,25 @@  discard block
 block discarded – undo
78 78
     private function loadRoutes()
79 79
     {
80 80
         foreach ($this->bootstrapService->getRoutes() as $route) {
81
-            $path = $route['path'];
82
-            $fileNameArray = explode('.', $route['filename']);
83
-            $routePrefix = $fileNameArray[0];
84
-            $version = $fileNameArray[1];
81
+            $path = $route[ 'path' ];
82
+            $fileNameArray = explode('.', $route[ 'filename' ]);
83
+            $routePrefix = $fileNameArray[ 0 ];
84
+            $version = $fileNameArray[ 1 ];
85 85
 
86 86
             if ($version === 'php')
87 87
                 $prefix = $routePrefix;
88 88
             else
89
-                $prefix = $version . '/' . $routePrefix;
89
+                $prefix = $version.'/'.$routePrefix;
90 90
 
91 91
             Route::group([
92 92
                 'prefix' => $prefix,
93
-                'namespace' => $route['controller'],
94
-                'domain' => $route['domain'],
95
-                'middleware' => ['api'],
96
-            ], function () use ($path) {
93
+                'namespace' => $route[ 'controller' ],
94
+                'domain' => $route[ 'domain' ],
95
+                'middleware' => [ 'api' ],
96
+            ], function() use ($path) {
97 97
                 require $path;
98 98
             });
99
-            Route::model($route['module'], $route['model']);
99
+            Route::model($route[ 'module' ], $route[ 'model' ]);
100 100
         }
101 101
     }
102 102
 
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
     protected function loadConfigs()
109 109
     {
110 110
         foreach ($this->bootstrapService->getConfigs() as $config) {
111
-            if (isset($config['filename']) && is_string($config['filename'])) {
112
-                $fileName = $config['filename'];
113
-                $configName = strtolower(explode('.',$fileName)[0]);
111
+            if (isset($config[ 'filename' ]) && is_string($config[ 'filename' ])) {
112
+                $fileName = $config[ 'filename' ];
113
+                $configName = strtolower(explode('.', $fileName)[ 0 ]);
114 114
                 $this->mergeConfigFrom(
115
-                    $config['path'], $configName
115
+                    $config[ 'path' ], $configName
116 116
                 );
117 117
             }
118 118
         }
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
     {
128 128
         foreach ($this->bootstrapService->getFactories() as $factory) {
129 129
             if (!$this->app->environment('production')) {
130
-                app(Factory::class)->load($factory['path']);
130
+                app(Factory::class)->load($factory[ 'path' ]);
131 131
             }
132 132
         }
133 133
     }
@@ -140,15 +140,15 @@  discard block
 block discarded – undo
140 140
     public function loadMigrations()
141 141
     {
142 142
         foreach ($this->bootstrapService->getMigrations() as $migration) {
143
-            $this->loadMigrationsFrom($migration['path']);
143
+            $this->loadMigrationsFrom($migration[ 'path' ]);
144 144
         }
145 145
     }
146 146
 
147 147
     private function loadPolicies()
148 148
     {
149 149
         foreach ($this->bootstrapService->getPolicies() as $policy) {
150
-            if (class_implements_interface($policy['class'], ModelPolicyContract::class)) {
151
-                Gate::policy($policy['model'], $policy['class']);
150
+            if (class_implements_interface($policy[ 'class' ], ModelPolicyContract::class)) {
151
+                Gate::policy($policy[ 'model' ], $policy[ 'class' ]);
152 152
             }
153 153
         }
154 154
     }
@@ -157,8 +157,8 @@  discard block
 block discarded – undo
157 157
     {
158 158
         $app = $this->app;
159 159
         $service = $this->bootstrapService;
160
-        $this->app->extend('command.seed', function () use ($app, $service) {
161
-            return new SeedCommand($app['db'], $service);
160
+        $this->app->extend('command.seed', function() use ($app, $service) {
161
+            return new SeedCommand($app[ 'db' ], $service);
162 162
         });
163 163
     }
164 164
 
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
         foreach ($this->bootstrapService->getModels() as $model) {
177 177
             if (class_implements_interface($model, Ownable::class)) {
178 178
                 Gate::policy($model, OwnershipPolicy::class);
179
-                Gate::define('access', OwnershipPolicy::class . '@access');
179
+                Gate::define('access', OwnershipPolicy::class.'@access');
180 180
             }
181 181
         }
182 182
     }
@@ -192,8 +192,8 @@  discard block
 block discarded – undo
192 192
     private function loadListeners()
193 193
     {
194 194
         foreach ($this->bootstrapService->getEvents() as $event) {
195
-            foreach ($event['listeners'] as $listener) {
196
-                Event::listen($event['class'], $listener);
195
+            foreach ($event[ 'listeners' ] as $listener) {
196
+                Event::listen($event[ 'class' ], $listener);
197 197
             }
198 198
         }
199 199
     }
Please login to merge, or discard this patch.
Braces   +11 added lines, -8 removed lines patch added patch discarded remove patch
@@ -83,10 +83,11 @@  discard block
 block discarded – undo
83 83
             $routePrefix = $fileNameArray[0];
84 84
             $version = $fileNameArray[1];
85 85
 
86
-            if ($version === 'php')
87
-                $prefix = $routePrefix;
88
-            else
89
-                $prefix = $version . '/' . $routePrefix;
86
+            if ($version === 'php') {
87
+                            $prefix = $routePrefix;
88
+            } else {
89
+                            $prefix = $version . '/' . $routePrefix;
90
+            }
90 91
 
91 92
             Route::group([
92 93
                 'prefix' => $prefix,
@@ -184,8 +185,9 @@  discard block
 block discarded – undo
184 185
     private function loadServiceProviders()
185 186
     {
186 187
         foreach ($this->bootstrapService->getProviders() as $provider) {
187
-            if ($this->passedRegistrationCondition($provider))
188
-                $this->app->register($provider);
188
+            if ($this->passedRegistrationCondition($provider)) {
189
+                            $this->app->register($provider);
190
+            }
189 191
         }
190 192
     }
191 193
 
@@ -200,8 +202,9 @@  discard block
 block discarded – undo
200 202
 
201 203
     private function passedRegistrationCondition($class)
202 204
     {
203
-        if (!class_implements_interface($class, ConditionalAutoRegistration::class))
204
-            return true;
205
+        if (!class_implements_interface($class, ConditionalAutoRegistration::class)) {
206
+                    return true;
207
+        }
205 208
         return run_class_function($class, 'registrationCondition');
206 209
     }
207 210
 }
Please login to merge, or discard this patch.
src/Foundation/Abstracts/Transformers/TransformerCollection.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 
16 16
 class TransformerCollection extends AnonymousResourceCollection
17 17
 {
18
-    protected $relations = [];
18
+    protected $relations = [ ];
19 19
 
20 20
     public function __construct($resource, string $collects)
21 21
     {
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
      */
31 31
     protected function findIncludedRelations($request, $resource, $collects)
32 32
     {
33
-        if (class_implements_interface($collects,Transformable::class)) {
33
+        if (class_implements_interface($collects, Transformable::class)) {
34 34
             $transformer = $collects::resource($resource->first());
35 35
             $relations = $transformer->getIncludedRelations($request);
36 36
         }
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 
50 50
     public function toArray($request)
51 51
     {
52
-        $collection = $this->collection->map(function ($item) {
52
+        $collection = $this->collection->map(function($item) {
53 53
             if ($item instanceof Transformer)
54 54
                 return $item->include($this->relations);
55 55
             else
Please login to merge, or discard this patch.
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -50,10 +50,11 @@
 block discarded – undo
50 50
     public function toArray($request)
51 51
     {
52 52
         $collection = $this->collection->map(function ($item) {
53
-            if ($item instanceof Transformer)
54
-                return $item->include($this->relations);
55
-            else
56
-                return $item;
53
+            if ($item instanceof Transformer) {
54
+                            return $item->include($this->relations);
55
+            } else {
56
+                            return $item;
57
+            }
57 58
         });
58 59
         return $collection->map->resolve($request)->all();
59 60
     }
Please login to merge, or discard this patch.
src/Foundation/Services/BootstrapRegistrarService.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -88,9 +88,9 @@  discard block
 block discarded – undo
88 88
      */
89 89
     private function buildEmptyBootstrapArray()
90 90
     {
91
-        $bootstrapArray = [];
91
+        $bootstrapArray = [ ];
92 92
         foreach ($this->moduleEntityDirectories as $key => $directory) {
93
-            $bootstrapArray[$key] = [];
93
+            $bootstrapArray[ $key ] = [ ];
94 94
         }
95 95
 
96 96
         return $bootstrapArray;
@@ -102,10 +102,10 @@  discard block
 block discarded – undo
102 102
     private function getModules(): array
103 103
     {
104 104
         $path = base_path('src/Modules');
105
-        $moduleNames = array_diff(scandir($path), ['..', '.']);
106
-        $modules = [];
105
+        $moduleNames = array_diff(scandir($path), [ '..', '.' ]);
106
+        $modules = [ ];
107 107
         foreach ($moduleNames as $moduleName) {
108
-            $modules[$moduleName] = $path.'/'.$moduleName;
108
+            $modules[ $moduleName ] = $path.'/'.$moduleName;
109 109
         }
110 110
 
111 111
         return $modules;
@@ -135,38 +135,38 @@  discard block
 block discarded – undo
135 135
                                         try {
136 136
                                             $command = new $class();
137 137
                                             if ($command instanceof Command) {
138
-                                                $bootstrap[$key][] = $class;
138
+                                                $bootstrap[ $key ][ ] = $class;
139 139
                                             }
140 140
                                         } catch (\Exception $e) {
141 141
                                             break;
142 142
                                         }
143 143
                                         break;
144 144
                                     case 'routes':
145
-                                        $bootstrap[$key][] = $this->buildRouteArray($directoryPath.'/'.$fileName, $namespace,$fileName);
145
+                                        $bootstrap[ $key ][ ] = $this->buildRouteArray($directoryPath.'/'.$fileName, $namespace, $fileName);
146 146
                                         break;
147 147
                                     case 'configs':
148
-                                        $bootstrap[$key][] = $this->buildConfigArray($directoryPath.'/'.$fileName, $moduleName, $fileName);
148
+                                        $bootstrap[ $key ][ ] = $this->buildConfigArray($directoryPath.'/'.$fileName, $moduleName, $fileName);
149 149
                                         break;
150 150
                                     case 'factories':
151
-                                        $bootstrap[$key][] = $this->buildDirectoryPathArray($directoryPath);
151
+                                        $bootstrap[ $key ][ ] = $this->buildDirectoryPathArray($directoryPath);
152 152
                                         break;
153 153
                                     case 'migrations':
154
-                                        $bootstrap[$key][] = $this->buildDirectoryPathArray($directoryPath);
154
+                                        $bootstrap[ $key ][ ] = $this->buildDirectoryPathArray($directoryPath);
155 155
                                         break;
156 156
                                     case 'seeders':
157
-                                        $bootstrap[$key][] = $class;
157
+                                        $bootstrap[ $key ][ ] = $class;
158 158
                                         break;
159 159
                                     case 'models':
160
-                                        $bootstrap[$key][] = $class;
160
+                                        $bootstrap[ $key ][ ] = $class;
161 161
                                         break;
162 162
                                     case 'policies':
163
-                                        $bootstrap[$key][] = $this->buildPolicyArray($class, $namespace);
163
+                                        $bootstrap[ $key ][ ] = $this->buildPolicyArray($class, $namespace);
164 164
                                         break;
165 165
                                     case 'providers':
166
-                                        $bootstrap[$key][] = $class;
166
+                                        $bootstrap[ $key ][ ] = $class;
167 167
                                         break;
168 168
                                     case 'events':
169
-                                        $bootstrap[$key][] = $this->buildEventsArray($class);
169
+                                        $bootstrap[ $key ][ ] = $this->buildEventsArray($class);
170 170
                                         break;
171 171
                                     default:
172 172
                                         break;
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
      */
189 189
     private function hasPhpExtension(string $fileName): bool
190 190
     {
191
-        return strlen($fileName) > 4 && '.php' === ($fileName[-4].$fileName[-3].$fileName[-2].$fileName[-1]);
191
+        return strlen($fileName) > 4 && '.php' === ($fileName[-4 ].$fileName[-3 ].$fileName[-2 ].$fileName[-1 ]);
192 192
     }
193 193
 
194 194
     /**
@@ -213,13 +213,13 @@  discard block
 block discarded – undo
213 213
      *
214 214
      * @return array
215 215
      */
216
-    private function buildRouteArray($path, $namespace,$fileName)
216
+    private function buildRouteArray($path, $namespace, $fileName)
217 217
     {
218 218
         $apiDomain = strtolower(env('API_URL'));
219 219
         $apiDomain = str_replace('http://', '', $apiDomain);
220 220
         $apiDomain = str_replace('https://', '', $apiDomain);
221 221
         $moduleNamespace = $namespace;
222
-        $moduleName = explode('\\', $moduleNamespace)[1];
222
+        $moduleName = explode('\\', $moduleNamespace)[ 1 ];
223 223
         $controllerNamespace = $moduleNamespace.'\\'.'Http\\Controllers';
224 224
         $modelNameSpace = $moduleNamespace.'\\'.'Entities\\'.$moduleName;
225 225
 
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
     private function buildPolicyArray($class, $namespace)
244 244
     {
245 245
         $moduleNamespace = $namespace;
246
-        $moduleName = explode('\\', $moduleNamespace)[1];
246
+        $moduleName = explode('\\', $moduleNamespace)[ 1 ];
247 247
         $modelNameSpace = $moduleNamespace.'\\'.'Entities\\'.$moduleName;
248 248
 
249 249
         return [
@@ -281,11 +281,11 @@  discard block
 block discarded – undo
281 281
 
282 282
     private function buildEventsArray($class)
283 283
     {
284
-        $listenerProperties = get_class_property($class, 'listeners') ?? [];
285
-        $listeners = [];
284
+        $listenerProperties = get_class_property($class, 'listeners') ?? [ ];
285
+        $listeners = [ ];
286 286
         foreach ($listenerProperties as $listener) {
287 287
             if (class_implements_interface($listener, ListenerContract::class)) {
288
-                $listeners[] = $listener;
288
+                $listeners[ ] = $listener;
289 289
             }
290 290
         }
291 291
 
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
      */
301 301
     public function getCommands(): array
302 302
     {
303
-        return $this->loadBootstrapFromCache()['commands'] ?? [];
303
+        return $this->loadBootstrapFromCache()[ 'commands' ] ?? [ ];
304 304
     }
305 305
 
306 306
     /**
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
      */
309 309
     public function getRoutes(): array
310 310
     {
311
-        return $this->loadBootstrapFromCache()['routes'] ?? [];
311
+        return $this->loadBootstrapFromCache()[ 'routes' ] ?? [ ];
312 312
     }
313 313
 
314 314
     /**
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
      */
317 317
     public function getConfigs(): array
318 318
     {
319
-        return $this->loadBootstrapFromCache()['configs'] ?? [];
319
+        return $this->loadBootstrapFromCache()[ 'configs' ] ?? [ ];
320 320
     }
321 321
 
322 322
     /**
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
      */
325 325
     public function getFactories(): array
326 326
     {
327
-        return $this->loadBootstrapFromCache()['factories'] ?? [];
327
+        return $this->loadBootstrapFromCache()[ 'factories' ] ?? [ ];
328 328
     }
329 329
 
330 330
     /**
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
      */
333 333
     public function getMigrations(): array
334 334
     {
335
-        return $this->loadBootstrapFromCache()['migrations'] ?? [];
335
+        return $this->loadBootstrapFromCache()[ 'migrations' ] ?? [ ];
336 336
     }
337 337
 
338 338
     /**
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
      */
341 341
     public function getSeeders(): array
342 342
     {
343
-        return $this->loadBootstrapFromCache()['seeders'] ?? [];
343
+        return $this->loadBootstrapFromCache()[ 'seeders' ] ?? [ ];
344 344
     }
345 345
 
346 346
     /**
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
      */
349 349
     public function getModels(): array
350 350
     {
351
-        return $this->loadBootstrapFromCache()['models'] ?? [];
351
+        return $this->loadBootstrapFromCache()[ 'models' ] ?? [ ];
352 352
     }
353 353
 
354 354
     /**
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
      */
357 357
     public function getPolicies(): array
358 358
     {
359
-        return $this->loadBootstrapFromCache()['policies'] ?? [];
359
+        return $this->loadBootstrapFromCache()[ 'policies' ] ?? [ ];
360 360
     }
361 361
 
362 362
     /**
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
      */
365 365
     public function getProviders(): array
366 366
     {
367
-        return $this->loadBootstrapFromCache()['providers'] ?? [];
367
+        return $this->loadBootstrapFromCache()[ 'providers' ] ?? [ ];
368 368
     }
369 369
 
370 370
     /**
@@ -372,6 +372,6 @@  discard block
 block discarded – undo
372 372
      */
373 373
     public function getEvents(): array
374 374
     {
375
-        return $this->loadBootstrapFromCache()['events'] ?? [];
375
+        return $this->loadBootstrapFromCache()[ 'events' ] ?? [ ];
376 376
     }
377 377
 }
Please login to merge, or discard this patch.
src/Modules/Machine/Policies/MachinePolicy.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,8 +34,8 @@
 block discarded – undo
34 34
 
35 35
         $maxMachineCount = 20;
36 36
 
37
-        if($machineCount > $maxMachineCount)
38
-            throw new Exception('You Cannot create more than 20 machines. Delete one first',401);
37
+        if ($machineCount > $maxMachineCount)
38
+            throw new Exception('You Cannot create more than 20 machines. Delete one first', 401);
39 39
     }
40 40
 
41 41
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,8 +34,9 @@
 block discarded – undo
34 34
 
35 35
         $maxMachineCount = 20;
36 36
 
37
-        if($machineCount > $maxMachineCount)
38
-            throw new Exception('You Cannot create more than 20 machines. Delete one first',401);
37
+        if($machineCount > $maxMachineCount) {
38
+                    throw new Exception('You Cannot create more than 20 machines. Delete one first',401);
39
+        }
39 40
     }
40 41
 
41 42
 
Please login to merge, or discard this patch.
src/Modules/Account/Policies/AccountPolicy.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,8 +34,8 @@
 block discarded – undo
34 34
 
35 35
         $maxAccountCount = 20;
36 36
 
37
-        if($AccountCount > $maxAccountCount)
38
-            throw new Exception('You Cannot create more than 20 Accounts. Delete one first',401);
37
+        if ($AccountCount > $maxAccountCount)
38
+            throw new Exception('You Cannot create more than 20 Accounts. Delete one first', 401);
39 39
     }
40 40
 
41 41
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,8 +34,9 @@
 block discarded – undo
34 34
 
35 35
         $maxAccountCount = 20;
36 36
 
37
-        if($AccountCount > $maxAccountCount)
38
-            throw new Exception('You Cannot create more than 20 Accounts. Delete one first',401);
37
+        if($AccountCount > $maxAccountCount) {
38
+                    throw new Exception('You Cannot create more than 20 Accounts. Delete one first',401);
39
+        }
39 40
     }
40 41
 
41 42
 
Please login to merge, or discard this patch.
src/Modules/Account/Events/AccountUpdatedEvent.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
 
17 17
 class AccountUpdatedEvent extends Event implements ShouldBroadcast
18 18
 {
19
-    public $listeners = [];
19
+    public $listeners = [ ];
20 20
 
21 21
     /**
22 22
      * @var Account
Please login to merge, or discard this patch.
src/Modules/Account/Database/factories/AccountFactory.php 2 patches
Indentation   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -1,95 +1,95 @@
 block discarded – undo
1 1
  <?php
2 2
 
3 3
 use Faker\Generator as Faker;
4
- use Modules\Account\Entities\Account;
4
+    use Modules\Account\Entities\Account;
5 5
 
6
- $factory->define(Account::class, function (Faker $faker) {
6
+    $factory->define(Account::class, function (Faker $faker) {
7 7
 
8
-     return [
9
-         'user_id' => 1,
10
-         'username' => $faker->unique()->safeEmail,
11
-         'password' => $faker->password,
12
-         'game'     => 'OSRS',
13
-         'banned_at' => $faker->boolean(80) ? null : \Carbon\Carbon::now()->subHours($faker->numberBetween(1, 500)),
14
-         'last_heartbeat_at' => $faker->boolean(50) ? null : \Carbon\Carbon::now()->subSeconds($faker->numberBetween(1, 500)),
15
-         'performance_mode' => array_random([
16
-             'EXTREME',
17
-             'MEDIUM',
18
-             'DISABLED'
19
-         ]),
20
-         'logged_in' => $faker->boolean,
21
-         'machine_id' => 1
22
-     ];
23
- });
8
+        return [
9
+            'user_id' => 1,
10
+            'username' => $faker->unique()->safeEmail,
11
+            'password' => $faker->password,
12
+            'game'     => 'OSRS',
13
+            'banned_at' => $faker->boolean(80) ? null : \Carbon\Carbon::now()->subHours($faker->numberBetween(1, 500)),
14
+            'last_heartbeat_at' => $faker->boolean(50) ? null : \Carbon\Carbon::now()->subSeconds($faker->numberBetween(1, 500)),
15
+            'performance_mode' => array_random([
16
+                'EXTREME',
17
+                'MEDIUM',
18
+                'DISABLED'
19
+            ]),
20
+            'logged_in' => $faker->boolean,
21
+            'machine_id' => 1
22
+        ];
23
+    });
24 24
 
25
- $factory->state(Account::class, 'OSRS', function (Faker $faker) {
26
-     return [
27
-         'game' => 'OSRS',
28
-         'bank_pin' => $faker->randomNumber(4, true),
29
-         'ingame_name' => $faker->userName,
30
-         'membership_expires_at' => $faker->boolean(80) ? null : \Carbon\Carbon::now()->addHours($faker->numberBetween(1, 500)),
31
-         "location" => [
32
-             "x" => $faker->numberBetween(-10000, 10000),
33
-             "y" => $faker->numberBetween(-10000, 10000),
34
-             "z" => $faker->numberBetween(0, 3)
35
-         ],
36
-         "skills" => [
37
-             "hitpoints" => $faker->numberBetween(0, 200000000),
38
-             "attack" => $faker->numberBetween(0, 200000000),
39
-             "strength" => $faker->numberBetween(0, 200000000),
40
-             "defence" => $faker->numberBetween(0, 200000000),
41
-             "ranged" => $faker->numberBetween(0, 200000000),
42
-             "prayer" => $faker->numberBetween(0, 200000000),
43
-             "magic" => $faker->numberBetween(0, 200000000),
44
-             "runecrafting" => $faker->numberBetween(0, 200000000),
45
-             "crafting" => $faker->numberBetween(0, 200000000),
46
-             "mining" => $faker->numberBetween(0, 200000000),
47
-             "smithing" => $faker->numberBetween(0, 200000000),
48
-             "fishing" => $faker->numberBetween(0, 200000000),
49
-             "cooking" => $faker->numberBetween(0, 200000000),
50
-             "firemaking" => $faker->numberBetween(0, 200000000),
51
-             "woodcutting" => $faker->numberBetween(0, 200000000),
52
-             "agility" => $faker->numberBetween(0, 200000000),
53
-             "herblore" => $faker->numberBetween(0, 200000000),
54
-             "thieving" => $faker->numberBetween(0, 200000000),
55
-             "fletching" => $faker->numberBetween(0, 200000000),
56
-             "slayer" => $faker->numberBetween(0, 200000000),
57
-             "farming" => $faker->numberBetween(0, 200000000),
58
-             "construction" => $faker->numberBetween(0, 200000000),
59
-             "hunter" => $faker->numberBetween(0, 200000000),
60
-         ],
61
-         "items" => [
62
-             "bank" => [
63
-                 [
64
-                     "item_id" => 5,
65
-                     "amount" => 2
66
-                 ],
67
-                 [
68
-                     "item_id" => 4,
69
-                     "amount" => 3
70
-                 ],
71
-                 [
72
-                     "item_id" => 2,
73
-                     "amount" => 1
74
-                 ]
75
-             ],
76
-             "equipment" => [],
77
-             "grand_exchange" => [
78
-                 [
79
-                     "item_id" => 5,
80
-                     "amount" => 2
81
-                 ]
82
-             ],
83
-             "inventory" => []
84
-         ]
85
-     ];
86
- });
25
+    $factory->state(Account::class, 'OSRS', function (Faker $faker) {
26
+        return [
27
+            'game' => 'OSRS',
28
+            'bank_pin' => $faker->randomNumber(4, true),
29
+            'ingame_name' => $faker->userName,
30
+            'membership_expires_at' => $faker->boolean(80) ? null : \Carbon\Carbon::now()->addHours($faker->numberBetween(1, 500)),
31
+            "location" => [
32
+                "x" => $faker->numberBetween(-10000, 10000),
33
+                "y" => $faker->numberBetween(-10000, 10000),
34
+                "z" => $faker->numberBetween(0, 3)
35
+            ],
36
+            "skills" => [
37
+                "hitpoints" => $faker->numberBetween(0, 200000000),
38
+                "attack" => $faker->numberBetween(0, 200000000),
39
+                "strength" => $faker->numberBetween(0, 200000000),
40
+                "defence" => $faker->numberBetween(0, 200000000),
41
+                "ranged" => $faker->numberBetween(0, 200000000),
42
+                "prayer" => $faker->numberBetween(0, 200000000),
43
+                "magic" => $faker->numberBetween(0, 200000000),
44
+                "runecrafting" => $faker->numberBetween(0, 200000000),
45
+                "crafting" => $faker->numberBetween(0, 200000000),
46
+                "mining" => $faker->numberBetween(0, 200000000),
47
+                "smithing" => $faker->numberBetween(0, 200000000),
48
+                "fishing" => $faker->numberBetween(0, 200000000),
49
+                "cooking" => $faker->numberBetween(0, 200000000),
50
+                "firemaking" => $faker->numberBetween(0, 200000000),
51
+                "woodcutting" => $faker->numberBetween(0, 200000000),
52
+                "agility" => $faker->numberBetween(0, 200000000),
53
+                "herblore" => $faker->numberBetween(0, 200000000),
54
+                "thieving" => $faker->numberBetween(0, 200000000),
55
+                "fletching" => $faker->numberBetween(0, 200000000),
56
+                "slayer" => $faker->numberBetween(0, 200000000),
57
+                "farming" => $faker->numberBetween(0, 200000000),
58
+                "construction" => $faker->numberBetween(0, 200000000),
59
+                "hunter" => $faker->numberBetween(0, 200000000),
60
+            ],
61
+            "items" => [
62
+                "bank" => [
63
+                    [
64
+                        "item_id" => 5,
65
+                        "amount" => 2
66
+                    ],
67
+                    [
68
+                        "item_id" => 4,
69
+                        "amount" => 3
70
+                    ],
71
+                    [
72
+                        "item_id" => 2,
73
+                        "amount" => 1
74
+                    ]
75
+                ],
76
+                "equipment" => [],
77
+                "grand_exchange" => [
78
+                    [
79
+                        "item_id" => 5,
80
+                        "amount" => 2
81
+                    ]
82
+                ],
83
+                "inventory" => []
84
+            ]
85
+        ];
86
+    });
87 87
 
88
- $factory->state(Account::class, 'RS3', function (Faker $faker) {
89
-     return [
90
-         'game' => 'RS3',
91
-         'bank_pin' => $faker->randomNumber(4, true),
92
-         'ingame_name' => $faker->userName,
93
-         'membership_expires_at' => null,
94
-     ];
95
- });
88
+    $factory->state(Account::class, 'RS3', function (Faker $faker) {
89
+        return [
90
+            'game' => 'RS3',
91
+            'bank_pin' => $faker->randomNumber(4, true),
92
+            'ingame_name' => $faker->userName,
93
+            'membership_expires_at' => null,
94
+        ];
95
+    });
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -3,7 +3,7 @@  discard block
 block discarded – undo
3 3
 use Faker\Generator as Faker;
4 4
  use Modules\Account\Entities\Account;
5 5
 
6
- $factory->define(Account::class, function (Faker $faker) {
6
+ $factory->define(Account::class, function(Faker $faker) {
7 7
 
8 8
      return [
9 9
          'user_id' => 1,
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
      ];
23 23
  });
24 24
 
25
- $factory->state(Account::class, 'OSRS', function (Faker $faker) {
25
+ $factory->state(Account::class, 'OSRS', function(Faker $faker) {
26 26
      return [
27 27
          'game' => 'OSRS',
28 28
          'bank_pin' => $faker->randomNumber(4, true),
@@ -73,19 +73,19 @@  discard block
 block discarded – undo
73 73
                      "amount" => 1
74 74
                  ]
75 75
              ],
76
-             "equipment" => [],
76
+             "equipment" => [ ],
77 77
              "grand_exchange" => [
78 78
                  [
79 79
                      "item_id" => 5,
80 80
                      "amount" => 2
81 81
                  ]
82 82
              ],
83
-             "inventory" => []
83
+             "inventory" => [ ]
84 84
          ]
85 85
      ];
86 86
  });
87 87
 
88
- $factory->state(Account::class, 'RS3', function (Faker $faker) {
88
+ $factory->state(Account::class, 'RS3', function(Faker $faker) {
89 89
      return [
90 90
          'game' => 'RS3',
91 91
          'bank_pin' => $faker->randomNumber(4, true),
Please login to merge, or discard this patch.
src/Modules/Account/Routes/accounts.v1.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -13,9 +13,9 @@
 block discarded – undo
13 13
 
14 14
 use Modules\Authorization\Entities\Permission;
15 15
 
16
-Route::get('/{id}', 'AccountController@show')->middleware(['permission:'.Permission::SHOW_ACCOUNT]);
17
-Route::patch('/{id}', 'AccountController@update')->middleware(['permission:'.Permission::UPDATE_ACCOUNT]);
18
-Route::delete('/{id}', 'AccountController@destroy')->middleware(['permission:'.Permission::DELETE_ACCOUNT]);
16
+Route::get('/{id}', 'AccountController@show')->middleware([ 'permission:'.Permission::SHOW_ACCOUNT ]);
17
+Route::patch('/{id}', 'AccountController@update')->middleware([ 'permission:'.Permission::UPDATE_ACCOUNT ]);
18
+Route::delete('/{id}', 'AccountController@destroy')->middleware([ 'permission:'.Permission::DELETE_ACCOUNT ]);
19 19
 
20
-Route::post('/', 'AccountController@store')->middleware(['permission:'.Permission::CREATE_ACCOUNT]);
21
-Route::get('/', 'AccountController@index')->middleware(['permission:'.Permission::INDEX_ACCOUNT]);
20
+Route::post('/', 'AccountController@store')->middleware([ 'permission:'.Permission::CREATE_ACCOUNT ]);
21
+Route::get('/', 'AccountController@index')->middleware([ 'permission:'.Permission::INDEX_ACCOUNT ]);
Please login to merge, or discard this patch.