Completed
Push — master ( 592d95...c00565 )
by Abdelrahman
18:11 queued 10s
created

OAuthUserProvider   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 80
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 1
dl 0
loc 80
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A retrieveById() 0 4 1
A retrieveByToken() 0 4 1
A updateRememberToken() 0 4 1
A retrieveByCredentials() 0 4 1
A validateCredentials() 0 4 1
A getUserType() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Rinvex\Oauth;
6
7
use Illuminate\Contracts\Auth\UserProvider;
8
use Illuminate\Contracts\Auth\Authenticatable;
9
10
class OAuthUserProvider implements UserProvider
11
{
12
    /**
13
     * The user provider instance.
14
     *
15
     * @var \Illuminate\Contracts\Auth\UserProvider
16
     */
17
    protected $provider;
18
19
    /**
20
     * The user provider name.
21
     *
22
     * @var string
23
     */
24
    protected $userType;
25
26
    /**
27
     * Create a new user provider.
28
     *
29
     * @param \Illuminate\Contracts\Auth\UserProvider $provider
30
     * @param string                                  $userType
31
     *
32
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
33
     */
34
    public function __construct(UserProvider $provider, $userType)
35
    {
36
        $this->provider = $provider;
37
        $this->userType = $userType;
38
    }
39
40
    /**
41
     * {@inheritdoc}
42
     */
43
    public function retrieveById($identifier)
44
    {
45
        return $this->provider->retrieveById($identifier);
46
    }
47
48
    /**
49
     * {@inheritdoc}
50
     */
51
    public function retrieveByToken($identifier, $rememberToken)
52
    {
53
        return $this->provider->retrieveByToken($identifier, $rememberToken);
54
    }
55
56
    /**
57
     * {@inheritdoc}
58
     */
59
    public function updateRememberToken(Authenticatable $user, $rememberToken)
60
    {
61
        $this->provider->updateRememberToken($user, $rememberToken);
62
    }
63
64
    /**
65
     * {@inheritdoc}
66
     */
67
    public function retrieveByCredentials(array $credentials)
68
    {
69
        return $this->provider->retrieveByCredentials($credentials);
70
    }
71
72
    /**
73
     * {@inheritdoc}
74
     */
75
    public function validateCredentials(Authenticatable $user, array $credentials)
76
    {
77
        return $this->provider->validateCredentials($user, $credentials);
78
    }
79
80
    /**
81
     * Get the name of the user type.
82
     *
83
     * @return string
84
     */
85
    public function getUserType()
86
    {
87
        return $this->userType;
88
    }
89
}
90