| Conditions | 3 |
| Paths | 3 |
| Total Lines | 14 |
| Code Lines | 7 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 3.0175 |
| Changes | 7 | ||
| Bugs | 3 | Features | 1 |
| 1 | <?php |
||
| 50 | 54 | public function handle(Request $request, Closure $next) |
|
| 51 | { |
||
| 52 | 54 | if ($this->auth->guest()) { |
|
| 53 | 2 | if ($request->ajax()) { |
|
| 54 | 1 | abort(401); |
|
| 55 | } |
||
| 56 | |||
| 57 | 1 | return redirect()->guest('/'); |
|
| 58 | } |
||
| 59 | |||
| 60 | 52 | app()->setLocale($this->auth->user()->language); |
|
|
|
|||
| 61 | |||
| 62 | 52 | return $next($request); |
|
| 63 | } |
||
| 64 | } |
||
| 65 |
If you access a property on an interface, you most likely code against a concrete implementation of the interface.
Available Fixes
Adding an additional type check:
Changing the type hint: