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 | 3 | public function addScope(ScopeEntityInterface $scope) |
|
46 | |||
47 | /** |
||
48 | * Return an array of scopes associated with the token. |
||
49 | * |
||
50 | * @return ScopeEntityInterface[] |
||
51 | */ |
||
52 | 2 | public function getScopes() |
|
56 | |||
57 | /** |
||
58 | * Get the token's expiry date time. |
||
59 | * |
||
60 | * @return \DateTime |
||
61 | */ |
||
62 | public function getExpiryDateTime() |
||
63 | { |
||
64 | return $this->expiryDateTime; |
||
65 | } |
||
66 | |||
67 | /** |
||
68 | * Set the date time when the token expires. |
||
69 | * |
||
70 | * @param \DateTime $dateTime |
||
71 | */ |
||
72 | 5 | public function setExpiryDateTime(\DateTime $dateTime) |
|
76 | |||
77 | /** |
||
78 | * Set the identifier of the user associated with the token. |
||
79 | * |
||
80 | * @param string|int|null $identifier The identifier of the user |
||
81 | */ |
||
82 | 5 | public function setUserIdentifier($identifier) |
|
86 | |||
87 | /** |
||
88 | * Get the token user's identifier. |
||
89 | * |
||
90 | * @return string|int|null |
||
91 | */ |
||
92 | 2 | public function getUserIdentifier() |
|
96 | |||
97 | /** |
||
98 | * Get the client that the token was issued to. |
||
99 | * |
||
100 | * @return ClientEntityInterface |
||
101 | */ |
||
102 | 2 | public function getClient() |
|
106 | |||
107 | /** |
||
108 | * Set the client that the token was issued to. |
||
109 | * |
||
110 | * @param ClientEntityInterface $client |
||
111 | */ |
||
112 | 5 | public function setClient(ClientEntityInterface $client) |
|
116 | } |
||
117 |