| Conditions | 2 |
| Paths | 2 |
| Total Lines | 23 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 14 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 10 | 5 | public function find(int $id) |
|
| 11 | { |
||
| 12 | 5 | $role = $this->query()->find($id); |
|
| 13 | |||
| 14 | 5 | if (null === $role) { |
|
| 15 | 1 | return null; |
|
| 16 | } |
||
| 17 | |||
| 18 | $permissions = array_map(static function ($permission) { |
||
| 19 | 1 | return app('mage.permissions')::find($permission['id']); |
|
|
|
|||
| 20 | 4 | }, $role->permissions->toArray()); |
|
| 21 | |||
| 22 | 4 | $role = app('mage.roles')::fromArray([ |
|
| 23 | 4 | 'id' => $role->id, |
|
| 24 | 4 | 'name' => $role->name, |
|
| 25 | 4 | 'guard_name' => $role->guard_name, |
|
| 26 | 4 | 'created_at' => $role->created_at, |
|
| 27 | 4 | 'updated_at' => $role->updated_at, |
|
| 28 | ]); |
||
| 29 | |||
| 30 | 4 | $role->assignPermissions($permissions); |
|
| 31 | |||
| 32 | 4 | return $role; |
|
| 33 | } |
||
| 35 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.