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.

Passport   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 1
Bugs 0 Features 1
Metric Value
dl 0
loc 53
rs 10
c 1
b 0
f 1
wmc 4
lcom 1
cbo 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A authenticate() 0 8 2
A getAuthorizationMethod() 0 4 1
1
<?php
2
3
namespace Milkmeowo\Framework\Dingo\Auth\Providers;
4
5
use Dingo\Api\Routing\Route;
6
use Illuminate\Http\Request;
7
use Illuminate\Auth\AuthManager;
8
use Dingo\Api\Auth\Provider\Authorization;
9
use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException;
10
11
class Passport extends Authorization
12
{
13
    /**
14
     * Illuminate authentication manager.
15
     *
16
     * @var \Illuminate\Contracts\Auth\Guard
17
     */
18
    protected $auth;
19
20
    /**
21
     * The guard driver name.
22
     *
23
     * @var string
24
     */
25
    protected $guard = 'api';
26
27
    /**
28
     * Create a new basic provider instance.
29
     *
30
     * @param \Illuminate\Auth\AuthManager $auth
31
     */
32
    public function __construct(AuthManager $auth)
33
    {
34
        $this->auth = $auth->guard($this->guard);
35
    }
36
37
    /**
38
     * Authenticate request with a Illuminate Guard.
39
     *
40
     * @param \Illuminate\Http\Request $request
41
     * @param \Dingo\Api\Routing\Route $route
42
     *
43
     * @return mixed
44
     */
45
    public function authenticate(Request $request, Route $route)
46
    {
47
        if (! $user = $this->auth->user()) {
48
            throw new UnauthorizedHttpException(null, 'Unauthenticated.');
49
        }
50
51
        return $user;
52
    }
53
54
    /**
55
     * Get the providers authorization method.
56
     *
57
     * @return string
58
     */
59
    public function getAuthorizationMethod()
60
    {
61
        return 'Bearer';
62
    }
63
}
64