Passed
Push — master ( a8d522...c97e91 )
by Alexandre
02:40
created

RefreshToken   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 68
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
dl 0
loc 68
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0
wmc 6

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A isExpired() 0 3 1
A getToken() 0 3 1
A getResourceOwnerIdentifier() 0 3 1
A getScope() 0 3 1
A getClientIdentifier() 0 3 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: Alexandre
5
 * Date: 07/03/2018
6
 * Time: 22:55
7
 */
8
9
namespace OAuth2\Credentials;
10
11
12
class RefreshToken implements RefreshTokenInterface
13
{
14
    /**
15
     * @var string
16
     */
17
    protected $token;
18
    /**
19
     * @var string
20
     */
21
    protected $scope;
22
    /**
23
     * @var string
24
     */
25
    protected $clientIdentifier;
26
    /**
27
     * @var string
28
     */
29
    protected $resourceOwnerIdentifier;
30
    /**
31
     * @var int
32
     */
33
    protected $expiresAt;
34
35
    public function __construct(string $token, string $scope, string $clientIdentifier, string $resourceOwnerIdentifier,
36
                                int $expiresAt)
37
    {
38
        $this->token = $token;
39
        $this->scope = $scope;
40
        $this->clientIdentifier = $clientIdentifier;
41
        $this->resourceOwnerIdentifier = $resourceOwnerIdentifier;
42
        $this->expiresAt = $expiresAt;
43
    }
44
45
    /**
46
     * @return string
47
     */
48
    public function getToken(): string
49
    {
50
        return $this->token;
51
    }
52
53
    /**
54
     * @return string
55
     */
56
    public function getScope(): string
57
    {
58
        return $this->scope;
59
    }
60
61
    /**
62
     * @return string
63 1
     */
64
    public function getClientIdentifier(): string
65 1
    {
66 1
        return $this->clientIdentifier;
67 1
    }
68
69 1
    /**
70
     * @return string
71
     */
72 1
    public function getResourceOwnerIdentifier(): string
73
    {
74 1
        return $this->resourceOwnerIdentifier;
75 1
    }
76 1
77 1
    public function isExpired(): bool
78 1
    {
79 1
        return time() > $this->expiresAt;
80
    }
81
}