| Conditions | 5 |
| Paths | 3 |
| Total Lines | 23 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 5 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 10 | 3 | public function handle(Request $request, Closure $next) |
|
| 11 | { |
||
| 12 | if ( |
||
| 13 | 3 | !$request->isSecure() |
|
| 14 | && ( |
||
| 15 | 3 | config('force-https.conditions.always') |
|
| 16 | 3 | || app()->environment(config('force-https.conditions.envs')) |
|
|
|
|||
| 17 | ) |
||
| 18 | ) { |
||
| 19 | 2 | $path = $request->path(); |
|
| 20 | 2 | if (config('force-https.redirect.query', false)) { |
|
| 21 | // Also affect merged data |
||
| 22 | 1 | $path .= '?' . http_build_query($request->query->all()); |
|
| 23 | } |
||
| 24 | |||
| 25 | 2 | return redirect()->secure( |
|
| 26 | 2 | $path, |
|
| 27 | 2 | config('force-https.redirect.status', false), |
|
| 28 | 2 | config('force-https.redirect.headers', []), |
|
| 29 | ); |
||
| 30 | } |
||
| 31 | |||
| 32 | 1 | return $next($request); |
|
| 33 | } |
||
| 35 |