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