| Conditions | 4 |
| Paths | 3 |
| Total Lines | 12 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | public function handle($request, Closure $next) |
||
| 19 | { |
||
| 20 | if ($request->hasCookie('referral')) { |
||
| 21 | return $next($request); |
||
| 22 | } |
||
| 23 | |||
| 24 | if (($ref = $request->query('ref')) && app(config('referral.user_model', 'App\User'))->referralExists($ref)) { |
||
| 25 | return redirect($request->fullUrl())->withCookie(cookie()->forever('referral', $ref)); |
||
|
|
|||
| 26 | } |
||
| 27 | |||
| 28 | return $next($request); |
||
| 29 | } |
||
| 30 | } |
||
| 31 |
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: