Conditions | 4 |
Paths | 5 |
Total Lines | 20 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
11 | public function handle(Request $request, Closure $next) |
||
12 | { |
||
13 | if (! config('personal-data-export.authentication_required')) { |
||
14 | return $next($request); |
||
15 | } |
||
16 | |||
17 | if (! auth()->user()) { |
||
|
|||
18 | abort(Response::HTTP_FORBIDDEN); |
||
19 | } |
||
20 | |||
21 | $zipFilename = $request->route('zipFilename'); |
||
22 | |||
23 | [$owningUserId] = explode('-', $zipFilename); |
||
24 | |||
25 | if ($owningUserId != auth()->user()->id) { |
||
26 | abort(Response::HTTP_UNAUTHORIZED); |
||
27 | } |
||
28 | |||
29 | return $next($request); |
||
30 | } |
||
31 | } |
||
32 |
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: