Passed
Pull Request — master (#14)
by ARCANEDEV
06:41
created
src/Core/Http/Middleware/EnsureIsAdmin.php 1 patch
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -41,10 +41,12 @@
 block discarded – undo
41 41
      */
42 42
     protected function ensureUserCanAccessAdminPanel($user)
43 43
     {
44
-        if (is_null($user))
45
-            abort(404, 'Page not found');
44
+        if (is_null($user)) {
45
+                    abort(404, 'Page not found');
46
+        }
46 47
 
47
-        if ( ! $user->isAdmin() && ! $user->isModerator())
48
-            abort(404, 'Page not found');
48
+        if ( ! $user->isAdmin() && ! $user->isModerator()) {
49
+                    abort(404, 'Page not found');
50
+        }
49 51
     }
50 52
 }
Please login to merge, or discard this patch.
src/Core/Http/Controllers/MetricsController.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,8 +29,9 @@
 block discarded – undo
29 29
 
30 30
         $metric = $manager->get($class);
31 31
 
32
-        if ($metric->authorizedToSee($request))
33
-            return response()->json($metric->resolve($request)->toArray());
32
+        if ($metric->authorizedToSee($request)) {
33
+                    return response()->json($metric->resolve($request)->toArray());
34
+        }
34 35
 
35 36
         return response()->json([
36 37
             'message' => 'Access Not Allowed',
Please login to merge, or discard this patch.
src/Core/CoreServiceProvider.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@
 block discarded – undo
63 63
      */
64 64
     private function extendMetricsAuthorization(): void
65 65
     {
66
-        Metric::macro('authorizedToSee', function (Request $request): bool {
66
+        Metric::macro('authorizedToSee', function(Request $request): bool {
67 67
             return method_exists($this, 'authorize')
68 68
                 ? $this->authorize($request) === true
69 69
                 : true;
Please login to merge, or discard this patch.
src/Core/ViewComposers/NotificationsComposer.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@
 block discarded – undo
60 60
     {
61 61
         $view->with(
62 62
             'foundationNotifications',
63
-            $this->notifier->notifications()->transform(function (array $notification) {
63
+            $this->notifier->notifications()->transform(function(array $notification) {
64 64
                 return static::prepareNotification($notification);
65 65
             })
66 66
         );
Please login to merge, or discard this patch.
src/Core/ViewComposers/MetricsComposer.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,10 +62,10 @@
 block discarded – undo
62 62
     public function compose(View $view): void
63 63
     {
64 64
         $metrics = $this->manager->makeSelected()
65
-            ->filter(function ($metric) {
65
+            ->filter(function($metric) {
66 66
                 return $metric->authorizedToSee(request());
67 67
             })
68
-            ->transform(function (Metric $metric) {
68
+            ->transform(function(Metric $metric) {
69 69
                 return Element::withTag("{$metric->type()}-metric")->attribute(':metric', $metric->toJson());
70 70
             });
71 71
 
Please login to merge, or discard this patch.
src/Auth/Metrics/Roles/TotalUsersByRoles.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
     public function calculate(Request $request, RolesRepository $repo)
33 33
     {
34 34
         // Calculate roles with users count
35
-        $result = $repo->withCount(['users'])->get()->filter(function ($role) {
35
+        $result = $repo->withCount(['users'])->get()->filter(function($role) {
36 36
             return $role->users_count > 0;
37 37
         })->pluck('users_count', 'name');
38 38
 
Please login to merge, or discard this patch.
src/Auth/Console/MakeUser.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@
 block discarded – undo
73 73
      */
74 74
     protected static function defaultCreateUserCallback(): Closure
75 75
     {
76
-        return function (string $firstName, string $lastName, string $email, string $password, bool $isAdmin) {
76
+        return function(string $firstName, string $lastName, string $email, string $password, bool $isAdmin) {
77 77
             /** @var  \Arcanesoft\Foundation\Auth\Repositories\UsersRepository  $repo */
78 78
             $repo = app(UsersRepository::class);
79 79
             $now  = Date::now();
Please login to merge, or discard this patch.
src/Auth/Models/Role.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
         if ( ! $this->isActive())
399 399
             return false;
400 400
 
401
-        return $this->permissions->filter(function (Permission $permission) use ($ability) {
401
+        return $this->permissions->filter(function(Permission $permission) use ($ability) {
402 402
             return $permission->hasAbility($ability);
403 403
         })->first() !== null;
404 404
     }
@@ -415,7 +415,7 @@  discard block
 block discarded – undo
415 415
     {
416 416
         $permissions = is_array($permissions) ? collect($permissions) : $permissions;
417 417
 
418
-        $failed = $permissions->reject(function ($permission) {
418
+        $failed = $permissions->reject(function($permission) {
419 419
             return $this->can($permission);
420 420
         })->values();
421 421
 
Please login to merge, or discard this patch.
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -170,8 +170,9 @@  discard block
 block discarded – undo
170 170
      */
171 171
     public function scopeFilterByAuthenticatedUser(Builder $query, User $user)
172 172
     {
173
-        if ($user->isSuperAdmin())
174
-            return $query;
173
+        if ($user->isSuperAdmin()) {
174
+                    return $query;
175
+        }
175 176
 
176 177
         return $query->where('key', '!=', static::ADMINISTRATOR);
177 178
     }
@@ -302,8 +303,9 @@  discard block
 block discarded – undo
302 303
      */
303 304
     public function attachUser($user, bool $reload = true)
304 305
     {
305
-        if ($this->hasUser($user))
306
-            return;
306
+        if ($this->hasUser($user)) {
307
+                    return;
308
+        }
307 309
 
308 310
         event(new AttachingUserToRole($this, $user));
309 311
         $this->users()->attach($user);
@@ -343,8 +345,9 @@  discard block
 block discarded – undo
343 345
      */
344 346
     public function attachPermission($permission, bool $reload = true)
345 347
     {
346
-        if ($this->hasPermission($permission))
347
-            return;
348
+        if ($this->hasPermission($permission)) {
349
+                    return;
350
+        }
348 351
 
349 352
         event(new AttachingPermissionToRole($this, $permission));
350 353
         $this->permissions()->attach($permission);
@@ -395,8 +398,9 @@  discard block
 block discarded – undo
395 398
      */
396 399
     public function can(string $ability): bool
397 400
     {
398
-        if ( ! $this->isActive())
399
-            return false;
401
+        if ( ! $this->isActive()) {
402
+                    return false;
403
+        }
400 404
 
401 405
         return $this->permissions->filter(function (Permission $permission) use ($ability) {
402 406
             return $permission->hasAbility($ability);
Please login to merge, or discard this patch.
src/Auth/Models/PermissionsGroup.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -311,7 +311,7 @@
 block discarded – undo
311 311
         $this->loadPermissions();
312 312
 
313 313
         return $this->permissions
314
-            ->filter(function (Permission $permission) use ($id) {
314
+            ->filter(function(Permission $permission) use ($id) {
315 315
                 return $permission->getKey() == $id;
316 316
             })
317 317
             ->first();
Please login to merge, or discard this patch.
Braces   +18 added lines, -12 removed lines patch added patch discarded remove patch
@@ -159,8 +159,9 @@  discard block
 block discarded – undo
159 159
      */
160 160
     public function attachPermission(&$permission, bool $reload = true)
161 161
     {
162
-        if ($this->hasPermission($permission))
163
-            return;
162
+        if ($this->hasPermission($permission)) {
163
+                    return;
164
+        }
164 165
 
165 166
         event(new AttachingPermissionToGroup($this, $permission));
166 167
         $permission = $this->permissions()->save($permission);
@@ -181,8 +182,9 @@  discard block
 block discarded – undo
181 182
     {
182 183
         $permission = $this->getPermissionById($id);
183 184
 
184
-        if ($permission !== null)
185
-            $this->attachPermission($permission, $reload);
185
+        if ($permission !== null) {
186
+                    $this->attachPermission($permission, $reload);
187
+        }
186 188
 
187 189
         return $permission;
188 190
     }
@@ -214,8 +216,9 @@  discard block
 block discarded – undo
214 216
      */
215 217
     public function detachPermission(&$permission, bool $reload = true)
216 218
     {
217
-        if ( ! $this->hasPermission($permission))
218
-            return;
219
+        if ( ! $this->hasPermission($permission)) {
220
+                    return;
221
+        }
219 222
 
220 223
         $permission = $this->getPermissionFromGroup($permission);
221 224
 
@@ -236,8 +239,9 @@  discard block
 block discarded – undo
236 239
      */
237 240
     public function detachPermissionById($id, bool $reload = true)
238 241
     {
239
-        if ( ! is_null($permission = $this->getPermissionById($id)))
240
-            $this->detachPermission($permission, $reload);
242
+        if ( ! is_null($permission = $this->getPermissionById($id))) {
243
+                    $this->detachPermission($permission, $reload);
244
+        }
241 245
 
242 246
         return $permission;
243 247
     }
@@ -285,8 +289,9 @@  discard block
 block discarded – undo
285 289
      */
286 290
     public function hasPermission($id)
287 291
     {
288
-        if ($id instanceof Model)
289
-            $id = $id->getKey();
292
+        if ($id instanceof Model) {
293
+                    $id = $id->getKey();
294
+        }
290 295
 
291 296
         return $this->getPermissionFromGroup($id) !== null;
292 297
     }
@@ -305,8 +310,9 @@  discard block
 block discarded – undo
305 310
      */
306 311
     private function getPermissionFromGroup($id)
307 312
     {
308
-        if ($id instanceof Model)
309
-            $id = $id->getKey();
313
+        if ($id instanceof Model) {
314
+                    $id = $id->getKey();
315
+        }
310 316
 
311 317
         $this->loadPermissions();
312 318
 
Please login to merge, or discard this patch.