Passed
Push — master ( c21d64...956340 )
by Arthur
05:06
created
src/Modules/User/Services/UserService.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
 {
17 17
     public function find($id): ?User
18 18
     {
19
-        return Cache::remember($this->getCacheName($id), $this->getCacheTime(), function () use ($id) {
19
+        return Cache::remember($this->getCacheName($id), $this->getCacheTime(), function() use ($id) {
20 20
             return User::find($id);
21 21
         });
22 22
     }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,8 +39,9 @@
 block discarded – undo
39 39
     public function delete($id): bool
40 40
     {
41 41
         $deleted = User::destroy($id);
42
-        if ($deleted)
43
-            Cache::forget($this->getCacheName($id));
42
+        if ($deleted) {
43
+                    Cache::forget($this->getCacheName($id));
44
+        }
44 45
         return $deleted;
45 46
     }
46 47
 
Please login to merge, or discard this patch.
src/Foundation/Middleware/Auth0AuthenticationMiddleware.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -38,14 +38,14 @@
 block discarded – undo
38 38
             $user = $this->auth0Repository->getUserByDecodedJWT($tokenInfo);
39 39
 
40 40
             if (!$user) {
41
-                return response()->json(['error' => 'Unauthorized user.'], 401);
41
+                return response()->json([ 'error' => 'Unauthorized user.' ], 401);
42 42
             }
43 43
 
44 44
             \Auth::login($user);
45 45
         } catch (InvalidTokenException $e) {
46
-            return response()->json(['error' => "Invalid or no token set."], 401);
46
+            return response()->json([ 'error' => "Invalid or no token set." ], 401);
47 47
         } catch (CoreException $e) {
48
-            return response()->json(['error' => $e->getMessage()], 401);
48
+            return response()->json([ 'error' => $e->getMessage() ], 401);
49 49
         }
50 50
 
51 51
         return $next($request);
Please login to merge, or discard this patch.
src/Foundation/Services/BootstrapRegistrarService.php 1 patch
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 
41 41
     private function storeInCache($data)
42 42
     {
43
-        file_put_contents($this->getCachePath(), '<?php return ' . var_export($data, true) . ';');
43
+        file_put_contents($this->getCachePath(), '<?php return '.var_export($data, true).';');
44 44
     }
45 45
 
46 46
     public function readFromCache()
@@ -60,14 +60,14 @@  discard block
 block discarded – undo
60 60
 
61 61
     private function getCachePath(): string
62 62
     {
63
-        return app()->bootstrapPath() . '/cache/' . $this->cacheFile;
63
+        return app()->bootstrapPath().'/cache/'.$this->cacheFile;
64 64
     }
65 65
 
66 66
     private function buildEmptyBootstrapArray()
67 67
     {
68
-        $bootstrapArray = [];
68
+        $bootstrapArray = [ ];
69 69
         foreach ($this->moduleEntityDirectories as $key => $directory) {
70
-            $bootstrapArray[$key] = [];
70
+            $bootstrapArray[ $key ] = [ ];
71 71
         }
72 72
         return $bootstrapArray;
73 73
     }
@@ -78,39 +78,39 @@  discard block
 block discarded – undo
78 78
         foreach (\Module::all() as $module) {
79 79
             foreach ($this->moduleEntityDirectories as $key => $directory) {
80 80
                 $directory = ucfirst($directory);
81
-                $directoryPath = $module->getPath() . '/' . $directory;
82
-                $namespace = 'Modules' . '\\' . $module->getName();
81
+                $directoryPath = $module->getPath().'/'.$directory;
82
+                $namespace = 'Modules'.'\\'.$module->getName();
83 83
                 if (file_exists($directoryPath)) {
84 84
                     $files = scandir($directoryPath);
85 85
                     foreach ($files as $fileName) {
86 86
                         if ($this->hasPhpExtension($fileName)) {
87 87
                             $className = basename($fileName, '.php');
88
-                            $class = $namespace . '\\' . str_replace('/', '\\', $directory) . '\\' . $className;
88
+                            $class = $namespace.'\\'.str_replace('/', '\\', $directory).'\\'.$className;
89 89
                             switch ($key) {
90 90
                                 case 'commands':
91 91
                                     try {
92 92
                                         $command = new $class();
93 93
                                         if ($command instanceof Command) {
94
-                                            $bootstrap[$key][] = $class;
94
+                                            $bootstrap[ $key ][ ] = $class;
95 95
                                         }
96 96
                                     } catch (\Exception $e) {
97 97
                                         break;
98 98
                                     }
99 99
                                     break;
100 100
                                 case 'routes':
101
-                                    $bootstrap[$key][] = $this->buildRouteArray($directoryPath . '/' . $fileName, $namespace);
101
+                                    $bootstrap[ $key ][ ] = $this->buildRouteArray($directoryPath.'/'.$fileName, $namespace);
102 102
                                     break;
103 103
                                 case 'configs':
104
-                                    $bootstrap[$key][] = $this->buildConfigArray($directoryPath . '/' . $fileName, $module->getName());
104
+                                    $bootstrap[ $key ][ ] = $this->buildConfigArray($directoryPath.'/'.$fileName, $module->getName());
105 105
                                     break;
106 106
                                 case 'factories':
107
-                                    $bootstrap[$key][] = $this->buildDirectoryPathArray($directoryPath);
107
+                                    $bootstrap[ $key ][ ] = $this->buildDirectoryPathArray($directoryPath);
108 108
                                     break;
109 109
                                 case 'migrations':
110
-                                    $bootstrap[$key][] = $this->buildDirectoryPathArray($directoryPath);
110
+                                    $bootstrap[ $key ][ ] = $this->buildDirectoryPathArray($directoryPath);
111 111
                                     break;
112 112
                                 case 'seeders':
113
-                                    $bootstrap[$key][] = $class;
113
+                                    $bootstrap[ $key ][ ] = $class;
114 114
                                     break;
115 115
                                 default:
116 116
                                     break;
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 
127 127
     private function hasPhpExtension(string $fileName): bool
128 128
     {
129
-        return strlen($fileName) > 4 && '.php' === ($fileName[-4] . $fileName[-3] . $fileName[-2] . $fileName[-1]);
129
+        return strlen($fileName) > 4 && '.php' === ($fileName[-4 ].$fileName[-3 ].$fileName[-2 ].$fileName[-1 ]);
130 130
     }
131 131
 
132 132
     public function loadBootstrapFromCache()
@@ -147,9 +147,9 @@  discard block
 block discarded – undo
147 147
         $apiDomain = str_replace('http://', '', $apiDomain);
148 148
         $apiDomain = str_replace('https://', '', $apiDomain);
149 149
         $moduleNamespace = $namespace;
150
-        $moduleName = explode('\\', $moduleNamespace)[1];
151
-        $controllerNamespace = $moduleNamespace . '\\' . 'Http\\Controllers';
152
-        $modelNameSpace = $moduleNamespace . '\\' . 'Entities\\' . $moduleName;
150
+        $moduleName = explode('\\', $moduleNamespace)[ 1 ];
151
+        $controllerNamespace = $moduleNamespace.'\\'.'Http\\Controllers';
152
+        $modelNameSpace = $moduleNamespace.'\\'.'Entities\\'.$moduleName;
153 153
         return [
154 154
             "path" => $path,
155 155
             "namespace" => $namespace,
@@ -177,31 +177,31 @@  discard block
 block discarded – undo
177 177
 
178 178
     public function getCommands(): array
179 179
     {
180
-        return $this->loadBootstrapFromCache()['commands'] ?? [];
180
+        return $this->loadBootstrapFromCache()[ 'commands' ] ?? [ ];
181 181
     }
182 182
 
183 183
     public function getRoutes(): array
184 184
     {
185
-        return $this->loadBootstrapFromCache()['routes'] ?? [];
185
+        return $this->loadBootstrapFromCache()[ 'routes' ] ?? [ ];
186 186
     }
187 187
 
188 188
     public function getConfigs(): array
189 189
     {
190
-        return $this->loadBootstrapFromCache()['configs'] ?? [];
190
+        return $this->loadBootstrapFromCache()[ 'configs' ] ?? [ ];
191 191
     }
192 192
 
193 193
     public function getFactories(): array
194 194
     {
195
-        return $this->loadBootstrapFromCache()['factories'] ?? [];
195
+        return $this->loadBootstrapFromCache()[ 'factories' ] ?? [ ];
196 196
     }
197 197
 
198 198
     public function getMigrations(): array
199 199
     {
200
-        return $this->loadBootstrapFromCache()['migrations'] ?? [];
200
+        return $this->loadBootstrapFromCache()[ 'migrations' ] ?? [ ];
201 201
     }
202 202
 
203 203
     public function getSeeders(): array
204 204
     {
205
-        return $this->loadBootstrapFromCache()['seeders'] ?? [];
205
+        return $this->loadBootstrapFromCache()[ 'seeders' ] ?? [ ];
206 206
     }
207 207
 }
Please login to merge, or discard this patch.
src/Foundation/Providers/BootstrapServiceProvider.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -49,16 +49,16 @@  discard block
 block discarded – undo
49 49
     private function loadRoutes()
50 50
     {
51 51
         foreach ($this->bootstrapService->getRoutes() as $route) {
52
-            $path = $route['path'];
52
+            $path = $route[ 'path' ];
53 53
             Route::group([
54
-                'prefix' => 'v1/' . $route['module'],
55
-                'namespace' => $route['controller'],
56
-                'domain' => $route['domain'],
57
-                'middleware' => ['api'],
58
-            ], function (Router $router) use ($path) {
54
+                'prefix' => 'v1/'.$route[ 'module' ],
55
+                'namespace' => $route[ 'controller' ],
56
+                'domain' => $route[ 'domain' ],
57
+                'middleware' => [ 'api' ],
58
+            ], function(Router $router) use ($path) {
59 59
                 require $path;
60 60
             });
61
-            Route::model($route['module'], $route['model']);
61
+            Route::model($route[ 'module' ], $route[ 'model' ]);
62 62
         }
63 63
     }
64 64
 
@@ -71,10 +71,10 @@  discard block
 block discarded – undo
71 71
     {
72 72
         foreach ($this->bootstrapService->getConfigs() as $config) {
73 73
             $this->publishes([
74
-                $config['path'] => config_path($config['module']),
74
+                $config[ 'path' ] => config_path($config[ 'module' ]),
75 75
             ], 'config');
76 76
             $this->mergeConfigFrom(
77
-                $config['path'], basename($config['module'], '.php')
77
+                $config[ 'path' ], basename($config[ 'module' ], '.php')
78 78
             );
79 79
         }
80 80
     }
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     {
89 89
         foreach ($this->bootstrapService->getFactories() as $factory) {
90 90
             if (!$this->app->environment('production')) {
91
-                app(Factory::class)->load($factory['path']);
91
+                app(Factory::class)->load($factory[ 'path' ]);
92 92
             }
93 93
         }
94 94
     }
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
     public function loadMigrations()
102 102
     {
103 103
         foreach ($this->bootstrapService->getMigrations() as $migration) {
104
-            $this->loadMigrationsFrom($migration['path']);
104
+            $this->loadMigrationsFrom($migration[ 'path' ]);
105 105
         }
106 106
     }
107 107
 
@@ -114,8 +114,8 @@  discard block
 block discarded – undo
114 114
     {
115 115
         $app = $this->app;
116 116
         $service = $this->bootstrapService;
117
-        $this->app->extend('command.seed', function () use ($app, $service) {
118
-            return new SeedCommand($app['db'], $service);
117
+        $this->app->extend('command.seed', function() use ($app, $service) {
118
+            return new SeedCommand($app[ 'db' ], $service);
119 119
         });
120 120
     }
121 121
 }
Please login to merge, or discard this patch.
src/Foundation/Tests/BootstrappingTest.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
 {
16 16
     protected $service;
17 17
 
18
-    public function __construct(?string $name = null, array $data = [], string $dataName = '')
18
+    public function __construct(?string $name = null, array $data = [ ], string $dataName = '')
19 19
     {
20 20
         parent::__construct($name, $data, $dataName);
21 21
         $this->service = new BootstrapRegistrarService();
Please login to merge, or discard this patch.
src/Foundation/Abstracts/Tests/HttpTest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -27,9 +27,9 @@  discard block
 block discarded – undo
27 27
 
28 28
     private function getUserTokenData(): \stdClass
29 29
     {
30
-        return Cache::remember('testing:http_access_token', 60, function () {
30
+        return Cache::remember('testing:http_access_token', 60, function() {
31 31
             $httpClient = new Client();
32
-            $response = $httpClient->post(config('laravel-auth0.domain') . 'oauth/token', [
32
+            $response = $httpClient->post(config('laravel-auth0.domain').'oauth/token', [
33 33
                 'form_params' => [
34 34
                     'grant_type' => 'password',
35 35
                     'client_id' => 'Dik7up1ZsRePpdZNjzrHIAUHe8mCb3RK',
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
 
50 50
     private function sendRequest(string $method, string $route, array $payload = array(), $authenticated = true): \Illuminate\Foundation\Testing\TestResponse
51 51
     {
52
-        return $this->json($method, env('API_URL') . '/' . $route, $payload, $authenticated ? [
53
-            "Authorization" => "Bearer " . $this->getUserTokenData()->id_token
54
-        ] : []);
52
+        return $this->json($method, env('API_URL').'/'.$route, $payload, $authenticated ? [
53
+            "Authorization" => "Bearer ".$this->getUserTokenData()->id_token
54
+        ] : [ ]);
55 55
     }
56 56
 
57 57
     protected function httpNoAuth(string $method, string $route, array $payload = array())
Please login to merge, or discard this patch.