| Conditions | 4 |
| Paths | 4 |
| Total Lines | 33 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | public function handle() |
||
| 19 | { |
||
| 20 | $style = $this->argument('style') ?? 'default'; |
||
| 21 | $guard = $this->argument('guard'); |
||
| 22 | |||
| 23 | if ($guard) { |
||
| 24 | $guards = Collection::make([$guard]); |
||
| 25 | } else { |
||
| 26 | $guards = Permission::pluck('guard_name')->merge(Role::pluck('guard_name'))->unique(); |
||
| 27 | } |
||
| 28 | |||
| 29 | foreach ($guards as $guard) { |
||
| 30 | $this->info("Guard: $guard"); |
||
| 31 | |||
| 32 | $roles = Role::whereGuardName($guard)->orderBy('name')->get()->mapWithKeys(function (Role $role) { |
||
|
|
|||
| 33 | return [$role->name => $role->permissions->pluck('name')]; |
||
| 34 | }); |
||
| 35 | |||
| 36 | $permissions = Permission::whereGuardName($guard)->orderBy('name')->pluck('name'); |
||
| 37 | |||
| 38 | $body = $permissions->map(function ($permission) use ($roles) { |
||
| 39 | return $roles->map(function (Collection $role_permissions) use ($permission) { |
||
| 40 | return $role_permissions->contains($permission) ? ' ✔' : ' ·'; |
||
| 41 | })->prepend($permission); |
||
| 42 | }); |
||
| 43 | |||
| 44 | $this->table( |
||
| 45 | $roles->keys()->prepend('')->toArray(), |
||
| 46 | $body->toArray(), |
||
| 47 | $style |
||
| 48 | ); |
||
| 49 | } |
||
| 50 | } |
||
| 51 | } |
||
| 52 |
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.