Total Complexity | 8 |
Total Lines | 86 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | <?php |
||
12 | class AccessToken implements AccessTokenInterface |
||
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 | * @var string |
||
36 | */ |
||
37 | protected $authorizationCode; |
||
38 | |||
39 | public function __construct(string $token, string $scope, string $clientIdentifier, string $resourceOwnerIdentifier, |
||
40 | int $expiresAt, ?string $authorizationCode = null) |
||
41 | { |
||
42 | $this->token = $token; |
||
43 | $this->scope = $scope; |
||
44 | $this->clientIdentifier = $clientIdentifier; |
||
45 | $this->resourceOwnerIdentifier = $resourceOwnerIdentifier; |
||
46 | $this->expiresAt = $expiresAt; |
||
47 | $this->authorizationCode = $authorizationCode; |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * @return string |
||
52 | */ |
||
53 | public function getToken(): string |
||
54 | { |
||
55 | return $this->token; |
||
56 | 2 | } |
|
57 | |||
58 | 2 | public function getType(): string |
|
59 | 2 | { |
|
60 | 2 | return 'bearer'; |
|
61 | } |
||
62 | 2 | ||
63 | /** |
||
64 | * @return string |
||
65 | */ |
||
66 | public function getScope(): string |
||
67 | { |
||
68 | return $this->scope; |
||
69 | } |
||
70 | |||
71 | /** |
||
72 | * @return string |
||
73 | */ |
||
74 | public function getClientIdentifier(): string |
||
77 | } |
||
78 | |||
79 | /** |
||
80 | * @return string |
||
81 | */ |
||
82 | public function getResourceOwnerIdentifier(): string |
||
83 | { |
||
84 | return $this->resourceOwnerIdentifier; |
||
85 | } |
||
86 | |||
87 | public function isExpired(): bool |
||
88 | { |
||
89 | return time() > $this->expiresAt; |
||
90 | } |
||
91 | 2 | ||
92 | /** |
||
93 | 2 | * @return string |
|
94 | 2 | */ |
|
95 | 2 | public function getAuthorizationCode(): string |
|
98 | } |
||
99 | } |