GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

FlareAuthenticate::handle()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 12
rs 9.8666
c 0
b 0
f 0
cc 3
nc 3
nop 2
1
<?php
2
3
namespace LaravelFlare\Flare\Http\Middleware;
4
5
use Closure;
6
use Illuminate\Http\Request;
7
use Illuminate\Contracts\Auth\Guard;
8
9
class FlareAuthenticate
10
{
11
    /**
12
     * The Guard implementation.
13
     *
14
     * @var Guard
15
     */
16
    protected $auth;
17
18
    /**
19
     * Create a new filter instance.
20
     *
21
     * @param Guard $auth
22
     */
23
    public function __construct(Guard $auth)
24
    {
25
        $this->auth = $auth;
26
    }
27
28
    /**
29
     * Handle an incoming request.
30
     *
31
     * @param \Illuminate\Http\Request $request
32
     * @param \Closure                 $next
33
     *
34
     * @return mixed
35
     */
36
    public function handle(Request $request, Closure $next)
37
    {
38
        if ($this->auth->guest()) {
39
            if ($request->ajax()) {
40
                return response('Unauthorized.', 401);
41
            }
42
43
            return redirect()->guest(\Flare::adminUrl('login'));
44
        }
45
46
        return $next($request);
47
    }
48
}
49