Conditions | 5 |
Paths | 4 |
Total Lines | 17 |
Code Lines | 7 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 5.583 |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php namespace Distilleries\Expendable\Http\Middleware; |
||
17 | 300 | public function handle($request, Closure $next, $guard = null) |
|
18 | { |
||
19 | 300 | $ipsAuth = env('BASIC_AUTH_IP',''); |
|
20 | 300 | $ipsAuth = explode(',',$ipsAuth); |
|
21 | |||
22 | |||
23 | 300 | if (env('BASIC_AUTH',false) == true) |
|
24 | { |
||
25 | if(empty($ipsAuth) || !in_array($request->ip(),$ipsAuth)) |
||
26 | { |
||
27 | return $this->auth->guard($guard)->basic() ?: $next($request); |
||
28 | } |
||
29 | |||
30 | } |
||
31 | |||
32 | 300 | return $next($request); |
|
33 | } |
||
34 | |||
35 | } |