Passed
Push — master ( 658575...3c4def )
by Jonathan
14:06
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/Http/Controllers/Core/Controller.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
      * @param Module $module
76 76
      * @param boolean $forBlade
77 77
      */
78
-    protected function preProcess(?Domain &$domain, Module $module, Request $request, $forBlade=true)
78
+    protected function preProcess(?Domain &$domain, Module $module, Request $request, $forBlade = true)
79 79
     {
80 80
         // If we don't use multi domains, find the first one
81 81
         if (!uccello()->useMultiDomains()) {
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
     {
158 158
         $keyName = $getAdminModules ? 'modules_all' : 'modules_not_admin';
159 159
 
160
-        return Cache::rememberForever($keyName, function () use($getAdminModules) {
160
+        return Cache::rememberForever($keyName, function() use($getAdminModules) {
161 161
             $modules = [ ];
162 162
 
163 163
             $allModules = Module::all();
@@ -215,11 +215,11 @@  discard block
 block discarded – undo
215 215
      */
216 216
     protected function getDomainsTreeHtml()
217 217
     {
218
-        return Cache::remember('users', 600, function () { // 10 minutes
218
+        return Cache::remember('users', 600, function() { // 10 minutes
219 219
             $domainsTreeHtml = '<ul class="tree tree-level-0">';
220 220
 
221 221
             $rootDomains = app('uccello')->getRootDomains();
222
-            foreach($rootDomains as $root) {
222
+            foreach ($rootDomains as $root) {
223 223
 
224 224
                 $descendants = $root->findDescendants()->get();
225 225
 
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 
228 228
                 $html = $tree->render(
229 229
                     'ul',
230
-                    function ($node) {
230
+                    function($node) {
231 231
                         if (auth()->user()->hasRoleOnDomain($node)) {
232 232
                             $currentClass = '';
233 233
                             // if ($node->id === $this->domain->id) {
Please login to merge, or discard this patch.
app/Models/User.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 
140 140
         $i = 0;
141 141
         foreach ($words as $w) {
142
-            $initials .= $w[0];
142
+            $initials .= $w[ 0 ];
143 143
             $i++;
144 144
 
145 145
             if ($i === 3) { // Maximum: 3 letters
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
         $image = 'vendor/uccello/uccello/images/user-no-image.png';
161 161
 
162 162
         if ($this->avatarType === 'gravatar') {
163
-            $image = 'https://www.gravatar.com/avatar/' . md5($this->email) . '?d=mm';
163
+            $image = 'https://www.gravatar.com/avatar/'.md5($this->email).'?d=mm';
164 164
 
165 165
         } elseif ($this->avatarType === 'image' && !empty($this->avatar->path)) {
166 166
             $image = $this->avatar->path;
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
      */
178 178
     public function rolesOnDomain($domain) : Collection
179 179
     {
180
-        return Cache::remember('domain_'.$domain->slug.'_roles', 600, function () use($domain) {
180
+        return Cache::remember('domain_'.$domain->slug.'_roles', 600, function() use($domain) {
181 181
             $roles = collect();
182 182
 
183 183
             foreach ($this->privileges->where('domain_id', $domain->id) as $privilege) {
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 
217 217
         $hasRole = false;
218 218
 
219
-        $descendants = Cache::remember('domain_'.$domain->slug.'_descendants', 600, function () use($domain) {
219
+        $descendants = Cache::remember('domain_'.$domain->slug.'_descendants', 600, function() use($domain) {
220 220
             return $domain->findDescendants()->get();
221 221
         });
222 222
 
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
     {
243 243
         $keyName = 'user_'.$this->id.'_'.$domain->slug.'_'.$module->name.'_capabilities';
244 244
 
245
-        return Cache::remember($keyName, 600, function () use($domain, $module) {
245
+        return Cache::remember($keyName, 600, function() use($domain, $module) {
246 246
             $capabilities = collect();
247 247
 
248 248
             // Get the domain and all its parents
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 
297 297
         $keyName = 'user_'.$this->id.'_'.$domain->slug.'_can_access_to_settings_panel';
298 298
 
299
-        return Cache::remember($keyName, 600, function () use($domain) {
299
+        return Cache::remember($keyName, 600, function() use($domain) {
300 300
 
301 301
             $hasCapability = false;
302 302
 
Please login to merge, or discard this patch.
app/Http/Controllers/User/AccountController.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -52,9 +52,9 @@  discard block
 block discarded – undo
52 52
         });
53 53
 
54 54
         $validator = Validator::make(request()->all(), [
55
-            'username' => $rules['username'],
56
-            'name' => $rules['name'],
57
-            'email' => $rules['email'],
55
+            'username' => $rules[ 'username' ],
56
+            'name' => $rules[ 'name' ],
57
+            'email' => $rules[ 'email' ],
58 58
         ]);
59 59
 
60 60
         if ($validator->fails()) {
@@ -93,11 +93,11 @@  discard block
 block discarded – undo
93 93
         if (request('avatar')) {
94 94
             $image = str_replace('data:image/png;base64,', '', request('avatar'));
95 95
             $image = str_replace(' ', '+', $image);
96
-            $imageName = 'user-' . $user->id . '.png';
96
+            $imageName = 'user-'.$user->id.'.png';
97 97
             $path = storage_path('app/public/avatar/');
98
-            $filepath = $path . $imageName;
98
+            $filepath = $path.$imageName;
99 99
 
100
-            if(!\File::isDirectory($path)){
100
+            if (!\File::isDirectory($path)) {
101 101
                 \File::makeDirectory($path, 0777, true, true);
102 102
             }
103 103
 
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 
129 129
         $field = Field::where('module_id', ucmodule('user')->id)->where('name', 'password')->first();
130 130
         $password_rules = isset($field->data->rules) ? explode('|', $field->data->rules) : '';
131
-        $password_rules[] = 'confirmed';
131
+        $password_rules[ ] = 'confirmed';
132 132
 
133 133
         $validator = Validator::make(request()->all(), [
134 134
             'current_password' => function($attribute, $value, $fail) use ($user) {
Please login to merge, or discard this patch.
app/Http/Controllers/Core/ListController.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
             ->get();
52 52
 
53 53
         // Order by
54
-        $filterOrderBy = (array) $selectedFilter->order_by;
54
+        $filterOrderBy = (array)$selectedFilter->order_by;
55 55
 
56 56
         return $this->autoView(compact('datatableColumns', 'filters', 'selectedFilter', 'filterOrderBy'));
57 57
     }
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
             if ($relatedList && $relatedList->method) {
116 116
                 // Related list method
117 117
                 $method = $relatedList->method;
118
-                $recordIdsMethod = $method . 'RecordIds';
118
+                $recordIdsMethod = $method.'RecordIds';
119 119
 
120 120
                 // Get related records ids
121 121
                 $model = new $modelClass;
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 
124 124
                 // Add the record id itself to be filtered
125 125
                 if ($relatedList->module_id === $relatedList->related_module_id && !empty($recordId) && !$filteredRecordIds->contains($recordId)) {
126
-                    $filteredRecordIds[] = (int)$recordId;
126
+                    $filteredRecordIds[ ] = (int)$recordId;
127 127
                 }
128 128
 
129 129
                 // Make the quer
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
             $records = $query->paginate($length);
135 135
         }
136 136
 
137
-        $records->getCollection()->transform(function ($record) use ($domain, $module) {
137
+        $records->getCollection()->transform(function($record) use ($domain, $module) {
138 138
             foreach ($module->fields as $field) {
139 139
                 // If a special template exists, use it. Else use the generic template
140 140
                 $uitype = uitype($field->uitype_id);
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
         $results = collect();
175 175
         if (method_exists($modelClass, 'getSearchResult') && property_exists($modelClass, 'searchableColumns')) {
176 176
             $searchResults = new Search();
177
-            $searchResults->registerModel($modelClass, (array) (new $modelClass)->searchableColumns);
177
+            $searchResults->registerModel($modelClass, (array)(new $modelClass)->searchableColumns);
178 178
             $results = $searchResults->search($q)->take(config('uccello.max_results.autocomplete', 10));
179 179
         }
180 180
 
@@ -195,9 +195,9 @@  discard block
 block discarded – undo
195 195
         $savePageLength = $request->input('save_page_length');
196 196
 
197 197
         // Optional data
198
-        $data = [];
198
+        $data = [ ];
199 199
         if ($savePageLength) {
200
-            $data["length"] = $request->input('page_length');
200
+            $data[ "length" ] = $request->input('page_length');
201 201
         }
202 202
 
203 203
         $filter = Filter::firstOrNew([
Please login to merge, or discard this patch.
app/Widgets/RelatedlistWidget.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -20,19 +20,19 @@
 block discarded – undo
20 20
     public function run()
21 21
     {
22 22
         // Get module
23
-        $module = ucmodule($this->config['module']);
23
+        $module = ucmodule($this->config[ 'module' ]);
24 24
 
25 25
         // Get record
26 26
         $modelClass = $module->model_class;
27
-        $record = $modelClass::find($this->config['record_id']);
27
+        $record = $modelClass::find($this->config[ 'record_id' ]);
28 28
 
29 29
         return view('uccello::widgets.relatedlist', [
30 30
             'config' => $this->config,
31
-            'domain' => ucdomain($this->config['domain']),
31
+            'domain' => ucdomain($this->config[ 'domain' ]),
32 32
             'module' => $module,
33
-            'data' => (object) $this->config['data'],
33
+            'data' => (object)$this->config[ 'data' ],
34 34
             'record' => $record,
35
-            'label' => $this->config['data']->label ?? $this->config['labelForTranslation'],
35
+            'label' => $this->config[ 'data' ]->label ?? $this->config[ 'labelForTranslation' ],
36 36
         ]);
37 37
     }
38 38
 }
Please login to merge, or discard this patch.