| Conditions | 2 |
| Paths | 2 |
| Total Lines | 32 |
| Code Lines | 22 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 21 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 13 | 4 | public function find(int $id) |
|
| 14 | { |
||
| 15 | 4 | $user = $this->query()->find($id); |
|
| 16 | |||
| 17 | 4 | if (null === $user) { |
|
| 18 | 1 | return null; |
|
| 19 | } |
||
| 20 | |||
| 21 | $permissions = array_map(static function ($permission) { |
||
| 22 | 1 | return app('mage.permissions')::find($permission['id']); |
|
|
|
|||
| 23 | 3 | }, $user->permissions->toArray()); |
|
| 24 | |||
| 25 | $roles = array_map(static function ($role) { |
||
| 26 | 1 | return app('mage.roles')::find($role['id']); |
|
| 27 | 3 | }, $user->roles->toArray()); |
|
| 28 | |||
| 29 | 3 | $user = app('mage.users')::fromArray([ |
|
| 30 | 3 | 'id' => $user->id, |
|
| 31 | 3 | 'name' => $user->name, |
|
| 32 | 3 | 'language' => $user->language, |
|
| 33 | 3 | 'email' => $user->email, |
|
| 34 | 3 | 'email_verified_at' => $user->verified_at, |
|
| 35 | 3 | 'password' => $user->password, |
|
| 36 | 3 | 'remember_token' => $user->remember_token, |
|
| 37 | 3 | 'created_at' => $user->created_at, |
|
| 38 | 3 | 'updated_at' => $user->updated_at, |
|
| 39 | ]); |
||
| 40 | |||
| 41 | 3 | $user->assignPermissions($permissions); |
|
| 42 | 3 | $user->assignRoles($roles); |
|
| 43 | |||
| 44 | 3 | return $user; |
|
| 45 | } |
||
| 47 |
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.