| Conditions | 3 |
| Paths | 2 |
| Total Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 6 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 9 | 8 | public function handle($request, Closure $next) |
|
| 10 | { |
||
| 11 | 8 | $userIds = explode(',', config('model-event-logger.user_id')); |
|
| 12 | 8 | $guard = config('model-event-logger.guard'); |
|
| 13 | |||
| 14 | 8 | if (! auth($guard)->check() || ! in_array(auth($guard)->id(), $userIds)) { |
|
| 15 | 1 | abort(403, "You're not authorised to perform this action"); |
|
| 16 | } |
||
| 17 | |||
| 18 | 7 | return $next($request); |
|
| 19 | } |
||
| 20 | } |
||
| 21 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: