| Conditions | 3 |
| Paths | 3 |
| Total Lines | 12 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 53 | protected function getStoredPermission($permissions) |
||
| 54 | { |
||
| 55 | if (is_string($permissions)) { |
||
| 56 | return app(Permission::class)->findByName($permissions); |
||
| 57 | } |
||
| 58 | |||
| 59 | if (is_array($permissions)) { |
||
| 60 | return app(Permission::class)->whereIn('name', $permissions)->get(); |
||
| 61 | } |
||
| 62 | |||
| 63 | return $permissions; |
||
| 64 | } |
||
| 65 | } |
||
| 66 |
In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.
If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.