1 | <?php |
||
10 | final class GenericAccessToken implements AccessTokenInterface |
||
11 | { |
||
12 | /** |
||
13 | * The token. |
||
14 | * |
||
15 | * @var TokenInterface |
||
16 | */ |
||
17 | private $token; |
||
18 | |||
19 | /** |
||
20 | * The attributes of the access token. |
||
21 | * |
||
22 | * @var array |
||
23 | */ |
||
24 | private $attributes; |
||
25 | |||
26 | /** |
||
27 | * GenericAccessToken constructor. |
||
28 | * |
||
29 | * @param TokenInterface $token The access token. |
||
30 | * @param array $attributes The attributes of the access token. |
||
31 | */ |
||
32 | 22 | public function __construct(TokenInterface $token, array $attributes) |
|
37 | |||
38 | /** |
||
39 | * Get the unique identifier of the authenticatable who owns the access token. |
||
40 | * |
||
41 | * @return string |
||
42 | */ |
||
43 | 7 | public function authenticatableId() |
|
47 | |||
48 | /** |
||
49 | * Get the token. |
||
50 | * |
||
51 | * @return TokenInterface |
||
52 | */ |
||
53 | 8 | public function token() |
|
57 | |||
58 | /** |
||
59 | * Get the access token as plain text. |
||
60 | * |
||
61 | * @return string |
||
62 | * @throws LogicException |
||
63 | */ |
||
64 | 2 | public function plain() |
|
73 | |||
74 | /** |
||
75 | * Get the access token encrypted. |
||
76 | * |
||
77 | * @return string |
||
78 | */ |
||
79 | 6 | public function encrypted() |
|
83 | |||
84 | /** |
||
85 | * Get the created at timestamp of the access token. |
||
86 | * |
||
87 | * @return \Carbon\Carbon |
||
88 | */ |
||
89 | 7 | public function createdAt() |
|
93 | |||
94 | /** |
||
95 | * Get the expires at timestamp of the access token. |
||
96 | * |
||
97 | * @return \Carbon\Carbon |
||
98 | */ |
||
99 | 6 | public function expiresAt() |
|
103 | |||
104 | /** |
||
105 | * Get a new instance of the access token with a longer expire date. |
||
106 | * |
||
107 | * @param int $prolong The prolong time in seconds. |
||
108 | * |
||
109 | * @return GenericAccessToken |
||
110 | */ |
||
111 | 6 | public function prolong($prolong) |
|
119 | |||
120 | /** |
||
121 | * Get the value of the given key. |
||
122 | * |
||
123 | * @param string $key |
||
124 | * |
||
125 | * @return mixed |
||
126 | */ |
||
127 | 8 | private function getAttributeValue($key) |
|
131 | |||
132 | /** |
||
133 | * Convert the access token to string. |
||
134 | * |
||
135 | * @return string |
||
136 | */ |
||
137 | 5 | public function __toString() |
|
141 | } |
||
142 |