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.

Handler::unauthenticated()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 4
nc 2
nop 2
1
<?php
2
3
namespace App\Exceptions;
4
5
use Exception;
6
use Illuminate\Auth\AuthenticationException;
7
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
8
9
class Handler extends ExceptionHandler
10
{
11
    /**
12
     * A list of the exception types that should not be reported.
13
     *
14
     * @var array
15
     */
16
    protected $dontReport = [
17
        \Illuminate\Auth\AuthenticationException::class,
18
        \Illuminate\Auth\Access\AuthorizationException::class,
19
        \Symfony\Component\HttpKernel\Exception\HttpException::class,
20
        \Illuminate\Database\Eloquent\ModelNotFoundException::class,
21
        \Illuminate\Session\TokenMismatchException::class,
22
        \Illuminate\Validation\ValidationException::class,
23
    ];
24
25
    /**
26
     * A list of the inputs that are never flashed for validation exceptions.
27
     *
28
     * @var array
29
     */
30
    protected $dontFlash = [
31
        'password',
32
        'password_confirmation',
33
    ];
34
35
    /**
36
     * Report or log an exception.
37
     *
38
     * This is a great spot to send exceptions to Sentry, Bugsnag, etc.
39
     *
40
     * @param Exception $e
41
     *
42
     * @return void
43
     */
44
    public function report(\Exception $e)
45
    {
46
        if ($this->shouldReport($e)) {
47
            app('sentry')->captureException($e);
48
        }
49
        parent::report($e);
50
    }
51
52
    /**
53
     * Render an exception into an HTTP response.
54
     *
55
     * @param \Illuminate\Http\Request $request
56
     * @param \Exception               $exception
57
     *
58
     * @return \Illuminate\Http\Response
59
     */
60
    public function render($request, Exception $exception)
61
    {
62
        return parent::render($request, $exception);
63
    }
64
65
    /**
66
     * Convert an authentication exception into an unauthenticated response.
67
     *
68
     * @param \Illuminate\Http\Request                 $request
69
     * @param \Illuminate\Auth\AuthenticationException $exception
70
     *
71
     * @return \Illuminate\Http\Response
72
     */
73
    protected function unauthenticated($request, AuthenticationException $exception)
74
    {
75
        if ($request->expectsJson()) {
76
            return response()->json(['error' => 'Unauthenticated.'], 401);
77
        }
78
79
        return redirect()->guest('login');
80
    }
81
}
82