Passed
Push — master ( 5d0db5...ea9eab )
by Jonathan
11:13
created
app/Helpers/Uccello.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -233,26 +233,26 @@  discard block
 block discarded – undo
233 233
 
234 234
         if (is_numeric($nameOrId)) {
235 235
             // Use cache
236
-            $modules = Cache::rememberForever('modules_by_id', function () {
236
+            $modules = Cache::rememberForever('modules_by_id', function() {
237 237
                 $modulesGroupedById = collect();
238 238
                 Module::all()->map(function($item) use($modulesGroupedById) {
239
-                    $modulesGroupedById[$item->id] = $item;
239
+                    $modulesGroupedById[ $item->id ] = $item;
240 240
                     return $modulesGroupedById;
241 241
                 });
242 242
                 return $modulesGroupedById;
243 243
             });
244
-            return $modules[(string) $nameOrId] ?? null;
244
+            return $modules[ (string)$nameOrId ] ?? null;
245 245
         } else {
246 246
             // Use cache
247
-            $modules = Cache::rememberForever('modules_by_name', function () {
247
+            $modules = Cache::rememberForever('modules_by_name', function() {
248 248
                 $modulesGroupedByName = collect();
249 249
                 Module::all()->map(function($item) use($modulesGroupedByName) {
250
-                    $modulesGroupedByName[$item->name] = $item;
250
+                    $modulesGroupedByName[ $item->name ] = $item;
251 251
                     return $modulesGroupedByName;
252 252
                 });
253 253
                 return $modulesGroupedByName;
254 254
             });
255
-            return $modules[(string) $nameOrId] ?? null;
255
+            return $modules[ (string)$nameOrId ] ?? null;
256 256
         }
257 257
     }
258 258
 
@@ -270,26 +270,26 @@  discard block
 block discarded – undo
270 270
 
271 271
         if (is_numeric($nameOrId)) {
272 272
             // Use cache
273
-            $uitypes = Cache::rememberForever('uitypes_by_id', function () {
273
+            $uitypes = Cache::rememberForever('uitypes_by_id', function() {
274 274
                 $uitypesGroupedById = collect();
275 275
                 Uitype::all()->map(function($item) use($uitypesGroupedById) {
276
-                    $uitypesGroupedById[$item->id] = $item;
276
+                    $uitypesGroupedById[ $item->id ] = $item;
277 277
                     return $uitypesGroupedById;
278 278
                 });
279 279
                 return $uitypesGroupedById;
280 280
             });
281
-            return $uitypes[(string) $nameOrId] ?? null;
281
+            return $uitypes[ (string)$nameOrId ] ?? null;
282 282
         } else {
283 283
             // Use cache
284
-            $uitypes = Cache::rememberForever('uitypes_by_name', function () {
284
+            $uitypes = Cache::rememberForever('uitypes_by_name', function() {
285 285
                 $uitypesGroupedByName = collect();
286 286
                 Uitype::all()->map(function($item) use($uitypesGroupedByName) {
287
-                    $uitypesGroupedByName[$item->name] = $item;
287
+                    $uitypesGroupedByName[ $item->name ] = $item;
288 288
                     return $uitypesGroupedByName;
289 289
                 });
290 290
                 return $uitypesGroupedByName;
291 291
             });
292
-            return $uitypes[(string) $nameOrId] ?? null;
292
+            return $uitypes[ (string)$nameOrId ] ?? null;
293 293
         }
294 294
     }
295 295
 
@@ -307,26 +307,26 @@  discard block
 block discarded – undo
307 307
 
308 308
         if (is_numeric($nameOrId)) {
309 309
             // Use cache
310
-            $displaytypes = Cache::rememberForever('displaytypes_by_id', function () {
310
+            $displaytypes = Cache::rememberForever('displaytypes_by_id', function() {
311 311
                 $displaytypesGroupedById = collect();
312 312
                 Displaytype::all()->map(function($item) use($displaytypesGroupedById) {
313
-                    $displaytypesGroupedById[$item->id] = $item;
313
+                    $displaytypesGroupedById[ $item->id ] = $item;
314 314
                     return $displaytypesGroupedById;
315 315
                 });
316 316
                 return $displaytypesGroupedById;
317 317
             });
318
-            return $displaytypes[(string) $nameOrId] ?? null;
318
+            return $displaytypes[ (string)$nameOrId ] ?? null;
319 319
         } else {
320 320
             // Use cache
321
-            $displaytypes = Cache::rememberForever('displaytypes_by_name', function () {
321
+            $displaytypes = Cache::rememberForever('displaytypes_by_name', function() {
322 322
                 $displaytypesGroupedByName = collect();
323 323
                 Displaytype::all()->map(function($item) use($displaytypesGroupedByName) {
324
-                    $displaytypesGroupedByName[$item->name] = $item;
324
+                    $displaytypesGroupedByName[ $item->name ] = $item;
325 325
                     return $displaytypesGroupedByName;
326 326
                 });
327 327
                 return $displaytypesGroupedByName;
328 328
             });
329
-            return $displaytypes[(string) $nameOrId] ?? null;
329
+            return $displaytypes[ (string)$nameOrId ] ?? null;
330 330
         }
331 331
     }
332 332
 
@@ -344,26 +344,26 @@  discard block
 block discarded – undo
344 344
 
345 345
         if (is_numeric($nameOrId)) {
346 346
             // Use cache
347
-            $capabilities = Cache::rememberForever('capabilities_by_id', function () {
347
+            $capabilities = Cache::rememberForever('capabilities_by_id', function() {
348 348
                 $capabilitiesGroupedById = collect();
349 349
                 Capability::all()->map(function($item) use($capabilitiesGroupedById) {
350
-                    $capabilitiesGroupedById[$item->id] = $item;
350
+                    $capabilitiesGroupedById[ $item->id ] = $item;
351 351
                     return $capabilitiesGroupedById;
352 352
                 });
353 353
                 return $capabilitiesGroupedById;
354 354
             });
355
-            return $capabilities[(string) $nameOrId] ?? null;
355
+            return $capabilities[ (string)$nameOrId ] ?? null;
356 356
         } else {
357 357
             // Use cache
358
-            $capabilities = Cache::rememberForever('capabilities_by_name', function () {
358
+            $capabilities = Cache::rememberForever('capabilities_by_name', function() {
359 359
                 $capabilitiesGroupedByName = collect();
360 360
                 Capability::all()->map(function($item) use($capabilitiesGroupedByName) {
361
-                    $capabilitiesGroupedByName[$item->name] = $item;
361
+                    $capabilitiesGroupedByName[ $item->name ] = $item;
362 362
                     return $capabilitiesGroupedByName;
363 363
                 });
364 364
                 return $capabilitiesGroupedByName;
365 365
             });
366
-            return $capabilities[(string) $nameOrId] ?? null;
366
+            return $capabilities[ (string)$nameOrId ] ?? null;
367 367
         }
368 368
     }
369 369
 
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
      * @param string $type
406 406
      * @return array
407 407
      */
408
-    public function getDatatableColumns(Module $module, $filterId=null, $type='list'): array
408
+    public function getDatatableColumns(Module $module, $filterId = null, $type = 'list'): array
409 409
     {
410 410
         $columns = [ ];
411 411
 
Please login to merge, or discard this patch.
app/Models/User.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 
148 148
         $i = 0;
149 149
         foreach ($words as $w) {
150
-            $initials .= $w[0];
150
+            $initials .= $w[ 0 ];
151 151
             $i++;
152 152
 
153 153
             if ($i === 3) { // Maximum: 3 letters
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
         $image = 'vendor/uccello/uccello/images/user-no-image.png';
169 169
 
170 170
         if ($this->avatarType === 'gravatar') {
171
-            $image = 'https://www.gravatar.com/avatar/' . md5($this->email) . '?d=mm';
171
+            $image = 'https://www.gravatar.com/avatar/'.md5($this->email).'?d=mm';
172 172
 
173 173
         } elseif ($this->avatarType === 'image' && !empty($this->avatar->path)) {
174 174
             $image = $this->avatar->path;
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
      */
186 186
     public function rolesOnDomain($domain) : Collection
187 187
     {
188
-        return Cache::remember('domain_'.$domain->slug.'_roles', 600, function () use($domain) {
188
+        return Cache::remember('domain_'.$domain->slug.'_roles', 600, function() use($domain) {
189 189
             $roles = collect();
190 190
 
191 191
             if (config('uccello.roles.display_ancestors_roles')) {
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 
234 234
         $hasRole = false;
235 235
 
236
-        $descendants = Cache::remember('domain_'.$domain->slug.'_descendants', 600, function () use($domain) {
236
+        $descendants = Cache::remember('domain_'.$domain->slug.'_descendants', 600, function() use($domain) {
237 237
             return $domain->findDescendants()->get();
238 238
         });
239 239
 
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
     {
260 260
         $keyName = 'user_'.$this->id.'_'.$domain->slug.'_'.$module->name.'_capabilities';
261 261
 
262
-        return Cache::remember($keyName, 600, function () use($domain, $module) {
262
+        return Cache::remember($keyName, 600, function() use($domain, $module) {
263 263
             $capabilities = collect();
264 264
 
265 265
             // Get the domain and all its parents
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 
314 314
         $keyName = 'user_'.$this->id.'_'.$domain->slug.'_can_access_to_settings_panel';
315 315
 
316
-        return Cache::remember($keyName, 600, function () use($domain) {
316
+        return Cache::remember($keyName, 600, function() use($domain) {
317 317
 
318 318
             $hasCapability = false;
319 319
 
@@ -465,8 +465,8 @@  discard block
 block discarded – undo
465 465
     {
466 466
         // Use cache
467 467
         $allowedGroups = Cache::rememberForever(
468
-            'allowed_groups_for_' . ($this->is_admin ? 'admin' : $this->getKey()),
469
-            function () {
468
+            'allowed_groups_for_'.($this->is_admin ? 'admin' : $this->getKey()),
469
+            function() {
470 470
                 return $this->getAllowedGroupUidsProcess();
471 471
             }
472 472
         );
@@ -478,8 +478,8 @@  discard block
 block discarded – undo
478 478
     {
479 479
         // Use cache
480 480
         $allowedGroupsAndUsers = Cache::rememberForever(
481
-            'allowed_group_users_for_' . ($addUsers ? 'u_' : '') . ($this->is_admin ? 'admin' : $this->getKey()),
482
-            function () use ($addUsers) {
481
+            'allowed_group_users_for_'.($addUsers ? 'u_' : '').($this->is_admin ? 'admin' : $this->getKey()),
482
+            function() use ($addUsers) {
483 483
                 return $this->getAllowedGroupsAndUsersProcess($addUsers);
484 484
             }
485 485
         );
@@ -489,16 +489,16 @@  discard block
 block discarded – undo
489 489
 
490 490
     protected function getAllowedGroupUidsProcess()
491 491
     {
492
-        $allowedUserUids = collect([$this->uuid]);
492
+        $allowedUserUids = collect([ $this->uuid ]);
493 493
 
494 494
         if ($this->is_admin) {
495 495
             $groups = Group::all();
496 496
         } else {
497
-            $groups = [];
498
-            $users = [];
497
+            $groups = [ ];
498
+            $users = [ ];
499 499
 
500 500
             foreach ($this->groups as $group) {
501
-                $groups[$group->uuid] = $group;
501
+                $groups[ $group->uuid ] = $group;
502 502
             };
503 503
 
504 504
             $this->addRecursiveChildrenGroups($groups, $users, $groups, false);
@@ -507,7 +507,7 @@  discard block
 block discarded – undo
507 507
         }
508 508
 
509 509
         foreach ($groups as $uid => $group) {
510
-            $allowedUserUids[] = $uid;
510
+            $allowedUserUids[ ] = $uid;
511 511
         }
512 512
 
513 513
         return $allowedUserUids;
@@ -516,19 +516,19 @@  discard block
 block discarded – undo
516 516
     protected function addRecursiveChildrenGroups(&$groups, &$users, $searchGroups, $addUsers = false)
517 517
     {
518 518
         foreach ($searchGroups as $uid => $searchGroup) {
519
-            $searchChildrenGroups = [];
519
+            $searchChildrenGroups = [ ];
520 520
 
521 521
             foreach ($searchGroup->childrenGroups as $childrenGroup) {
522
-                if (empty($groups[$childrenGroup->uuid])) {
523
-                    $groups[$childrenGroup->uuid] = $childrenGroup;
524
-                    $searchChildrenGroups[$childrenGroup->uuid] = $childrenGroup;
522
+                if (empty($groups[ $childrenGroup->uuid ])) {
523
+                    $groups[ $childrenGroup->uuid ] = $childrenGroup;
524
+                    $searchChildrenGroups[ $childrenGroup->uuid ] = $childrenGroup;
525 525
                 }
526 526
 
527
-                if($addUsers)
527
+                if ($addUsers)
528 528
                 {
529 529
                     foreach ($childrenGroup->users as $user) {
530
-                        if (empty($users[$user->uuid])) {
531
-                            $users[$user->uuid] = $user;
530
+                        if (empty($users[ $user->uuid ])) {
531
+                            $users[ $user->uuid ] = $user;
532 532
                         }
533 533
                     }
534 534
                 }
@@ -540,26 +540,26 @@  discard block
 block discarded – undo
540 540
 
541 541
     protected function getAllowedGroupsAndUsersProcess($addUsers = true)
542 542
     {
543
-        $allowedUserUids = collect([[
543
+        $allowedUserUids = collect([ [
544 544
             'uuid' => $this->uuid,
545 545
             'recordLabel' => uctrans('me', $this->module)
546
-        ]]);
546
+        ] ]);
547 547
 
548 548
         if ($this->is_admin) {
549 549
             $groups = Group::orderBy('name')->get();
550 550
             $users  = \App\User::orderBy('name')->get();
551 551
         } else {
552
-            $groups = [];
553
-            $users = [];
552
+            $groups = [ ];
553
+            $users = [ ];
554 554
 
555 555
             foreach ($this->groups as $group) {
556
-                $groups[$group->uuid] = $group;
556
+                $groups[ $group->uuid ] = $group;
557 557
 
558
-                if($addUsers)
558
+                if ($addUsers)
559 559
                 {
560 560
                     foreach ($group->users as $user) {
561
-                        if (empty($users[$user->uuid])) {
562
-                            $users[$user->uuid] = $user;
561
+                        if (empty($users[ $user->uuid ])) {
562
+                            $users[ $user->uuid ] = $user;
563 563
                         }
564 564
                     }
565 565
                 }
@@ -572,15 +572,15 @@  discard block
 block discarded – undo
572 572
         }
573 573
 
574 574
         foreach ($groups as $uid => $group) {
575
-            $allowedUserUids[] = [
575
+            $allowedUserUids[ ] = [
576 576
                 'uuid' => $group->uuid,
577 577
                 'recordLabel' => $group->recordLabel
578 578
             ];
579 579
         }
580 580
 
581 581
         foreach ($users as $uid => $user) {
582
-            if($user->getKey() != $this->getKey()) {
583
-                $allowedUserUids[] = [
582
+            if ($user->getKey() != $this->getKey()) {
583
+                $allowedUserUids[ ] = [
584 584
                     'uuid' => $user->uuid,
585 585
                     'recordLabel' => $user->recordLabel
586 586
                 ];
Please login to merge, or discard this patch.
app/Support/Traits/UccelloModule.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
     {
20 20
         parent::boot();
21 21
 
22
-        if(static::isFilteredByUser())
22
+        if (static::isFilteredByUser())
23 23
         {
24 24
             static::addGlobalScope(new AssignedUser);
25 25
         }
@@ -29,11 +29,11 @@  discard block
 block discarded – undo
29 29
     {
30 30
         $user = Auth::user();
31 31
 
32
-        if($user && !$user->is_admin)
32
+        if ($user && !$user->is_admin)
33 33
         {
34 34
             $module = static::getModuleFromClass(static::class);
35 35
 
36
-            if($module && $module->data && property_exists($module->data, 'private') &&  $module->data->private)
36
+            if ($module && $module->data && property_exists($module->data, 'private') && $module->data->private)
37 37
             {
38 38
                 return true;
39 39
             }
@@ -54,15 +54,15 @@  discard block
 block discarded – undo
54 54
 
55 55
     protected static function getModuleFromClass($className)
56 56
     {
57
-        $modules = Cache::rememberForever('modules_by_model_class', function () {
57
+        $modules = Cache::rememberForever('modules_by_model_class', function() {
58 58
             $modulesGroupedByModelClass = collect();
59
-            Module::all()->map(function ($item) use ($modulesGroupedByModelClass) {
60
-                $modulesGroupedByModelClass[$item->model_class] = $item;
59
+            Module::all()->map(function($item) use ($modulesGroupedByModelClass) {
60
+                $modulesGroupedByModelClass[ $item->model_class ] = $item;
61 61
                 return $modulesGroupedByModelClass;
62 62
             });
63 63
             return $modulesGroupedByModelClass;
64 64
         });
65
-        return $modules[(string) $className] ?? null;
65
+        return $modules[ (string)$className ] ?? null;
66 66
     }
67 67
 
68 68
     public function getUuidAttribute()
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
                         ->where('record_id', $this->getKey())
74 74
                         ->first();
75 75
 
76
-        if($entity)
76
+        if ($entity)
77 77
         {
78 78
             $uuid = $entity->getKey();
79 79
         }
Please login to merge, or discard this patch.
app/Fields/Uitype/AssignedUser.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -109,8 +109,8 @@
 block discarded – undo
109 109
      */
110 110
     public function addConditionToSearchQuery(Builder $query, Field $field, $value) : Builder
111 111
     {
112
-        $query->where(function ($query) use($field, $value) {
113
-            foreach ((array) $value as $_value) {
112
+        $query->where(function($query) use($field, $value) {
113
+            foreach ((array)$value as $_value) {
114 114
                 // Replace me by connected user's id
115 115
                 if ($_value === 'me') {
116 116
                     $_value = Auth::user()->uuid;
Please login to merge, or discard this patch.