Passed
Push — master ( 054b32...1c77af )
by Ron
07:39 queued 12s
created

CheckBrowser   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 60%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 22
ccs 3
cts 5
cp 0.6
rs 10
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A handle() 0 13 3
1
<?php
2
3
namespace App\Http\Middleware;
4
5
use Closure;
6
7
class CheckBrowser
8
{
9
    /**
10
     * Handle an incoming request.
11
     *
12
     * @param  \Illuminate\Http\Request  $request
13
     * @param  \Closure  $next
14
     * @return mixed
15
     */
16 568
    public function handle($request, Closure $next)
17
    {
18
        //  Browser check will only fire if the HTTP_USER_AGENT string is actually set by the browser
19 568
        if(!empty($_SERVER['HTTP_USER_AGENT']))
20
        {
21
            //  Check for Internet Explorer 11
22
            if (preg_match("/Trident\/7.0;(.*)rv:11.0/", $_SERVER["HTTP_USER_AGENT"], $match) != 0)
23
            {
24
                return response()->make(view('error.426'), 426);
25
            }
26
        }
27
28 568
        return $next($request);
29
    }
30
}
31