1 | <?php |
||
16 | trait TokenEntityTrait |
||
17 | { |
||
18 | /** |
||
19 | * @var ScopeEntityInterface[] |
||
20 | */ |
||
21 | protected $scopes = []; |
||
22 | |||
23 | /** |
||
24 | * @var DateTime |
||
25 | */ |
||
26 | protected $expiryDateTime; |
||
27 | |||
28 | /** |
||
29 | * @var string|int |
||
30 | */ |
||
31 | protected $userIdentifier; |
||
32 | |||
33 | /** |
||
34 | * @var ClientEntityInterface |
||
35 | */ |
||
36 | protected $client; |
||
37 | |||
38 | /** |
||
39 | * Associate a scope with the token. |
||
40 | * |
||
41 | * @param \League\OAuth2\Server\Entities\ScopeEntityInterface $scope |
||
42 | */ |
||
43 | public function addScope(ScopeEntityInterface $scope) |
||
47 | |||
48 | /** |
||
49 | * Return an array of scopes associated with the token. |
||
50 | * |
||
51 | * @return ScopeEntityInterface[] |
||
52 | */ |
||
53 | public function getScopes() |
||
57 | |||
58 | /** |
||
59 | * Get the token's expiry date time. |
||
60 | * |
||
61 | * @return DateTime |
||
62 | */ |
||
63 | public function getExpiryDateTime() |
||
67 | |||
68 | /** |
||
69 | * Set the date time when the token expires. |
||
70 | * |
||
71 | * @param DateTime $dateTime |
||
72 | */ |
||
73 | public function setExpiryDateTime(DateTime $dateTime) |
||
77 | |||
78 | /** |
||
79 | * Set the identifier of the user associated with the token. |
||
80 | * |
||
81 | * @param string|int $identifier The identifier of the user |
||
82 | */ |
||
83 | public function setUserIdentifier($identifier) |
||
87 | |||
88 | /** |
||
89 | * Get the token user's identifier. |
||
90 | * |
||
91 | * @return string|int |
||
92 | */ |
||
93 | public function getUserIdentifier() |
||
97 | |||
98 | /** |
||
99 | * Get the client that the token was issued to. |
||
100 | * |
||
101 | * @return ClientEntityInterface |
||
102 | */ |
||
103 | public function getClient() |
||
107 | |||
108 | /** |
||
109 | * Set the client that the token was issued to. |
||
110 | * |
||
111 | * @param \League\OAuth2\Server\Entities\ClientEntityInterface $client |
||
112 | */ |
||
113 | public function setClient(ClientEntityInterface $client) |
||
117 | |||
118 | /** |
||
119 | * Has the token expired? |
||
120 | * |
||
121 | * @return bool |
||
122 | */ |
||
123 | public function isExpired() |
||
127 | } |
||
128 |