| Conditions | 2 |
| Paths | 2 |
| Total Lines | 62 |
| Code Lines | 37 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 43 | public function handle() |
||
| 44 | { |
||
| 45 | if (! config('adminetic.migrate_with_dummy', false)) { |
||
| 46 | // Generating Roles |
||
| 47 | $roles = [ |
||
| 48 | [ |
||
| 49 | 'name' => 'superadmin', |
||
| 50 | 'description' => 'This is a super admin user', |
||
| 51 | 'level' => 5, |
||
| 52 | ], |
||
| 53 | [ |
||
| 54 | 'name' => 'admin', |
||
| 55 | 'description' => 'This is an admin user', |
||
| 56 | 'level' => 4, |
||
| 57 | ], |
||
| 58 | [ |
||
| 59 | 'name' => 'moderator', |
||
| 60 | 'description' => 'This is an moderator', |
||
| 61 | 'level' => 3, |
||
| 62 | ], |
||
| 63 | [ |
||
| 64 | 'name' => 'editor', |
||
| 65 | 'description' => 'This is an editor', |
||
| 66 | 'level' => 2, |
||
| 67 | ], |
||
| 68 | [ |
||
| 69 | 'name' => 'user', |
||
| 70 | 'description' => 'This is an normal user', |
||
| 71 | 'level' => 1, |
||
| 72 | ], |
||
| 73 | [ |
||
| 74 | 'name' => 'unverified', |
||
| 75 | 'description' => 'This is an unverified user', |
||
| 76 | 'level' => 0, |
||
| 77 | ], |
||
| 78 | ]; |
||
| 79 | |||
| 80 | DB::table('roles')->insert($roles); |
||
| 81 | |||
| 82 | // Generating Permission |
||
| 83 | Artisan::call('make:permission Role 2 --onlyFlags'); |
||
| 84 | Artisan::call('make:permission Permission 2 --onlyFlags'); |
||
| 85 | Artisan::call('make:permission User 2 --onlyFlags'); |
||
| 86 | |||
| 87 | Artisan::call('make:permission Setting 2 --onlyFlags'); |
||
| 88 | Artisan::call('make:permission Preference 2 --onlyFlags'); |
||
| 89 | |||
| 90 | // Generating User |
||
| 91 | $admin = User::create([ |
||
| 92 | 'name' => 'Admin User', |
||
| 93 | 'email' => '[email protected]', |
||
| 94 | 'password' => Hash::make('admin123'), |
||
| 95 | ]); |
||
| 96 | |||
| 97 | $role = Role::where('name', 'admin')->first(); |
||
| 98 | |||
| 99 | $admin->roles()->attach($role); |
||
| 100 | $admin->profile()->create(); |
||
| 101 | $this->info('Dummy data seeded ... ✅'); |
||
| 102 | } else { |
||
| 103 | $this->error('Dummy data seeding failed because seed on migration is turned on config file.'); |
||
| 104 | $this->warning("Change to 'migrate_with_dummy' => false"); |
||
| 105 | } |
||
| 108 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths