1+ <?php
2+
3+ namespace App \Domain \Model ;
4+
5+ class AccessToken
6+ {
7+ /**
8+ * @var string
9+ */
10+ private $ id ;
11+
12+ /**
13+ * @var string
14+ */
15+ private $ userId ;
16+
17+ /**
18+ * @var string
19+ */
20+ private $ clientId ;
21+
22+ /**
23+ * @var array
24+ */
25+ private $ scopes ;
26+
27+ /**
28+ * @var bool
29+ */
30+ private $ revoked ;
31+
32+ /**
33+ * @var \DateTime
34+ */
35+ private $ createdAt ;
36+
37+ /**
38+ * @var \DateTime
39+ */
40+ private $ updatedAt ;
41+
42+ /**
43+ * @var \DateTime
44+ */
45+ private $ expiresAt ;
46+
47+ /**
48+ * Token constructor.
49+ * @param string $id
50+ * @param string $userId
51+ * @param string $clientId
52+ * @param array $scopes
53+ * @param bool $revoked
54+ * @param \DateTime $createdAt
55+ * @param \DateTime $updatedAt
56+ * @param \DateTime $expiresAt
57+ */
58+ public function __construct (
59+ string $ id ,
60+ string $ userId ,
61+ string $ clientId ,
62+ array $ scopes ,
63+ bool $ revoked ,
64+ \DateTime $ createdAt ,
65+ \DateTime $ updatedAt ,
66+ \DateTime $ expiresAt
67+ ) {
68+ $ this ->id = $ id ;
69+ $ this ->userId = $ userId ;
70+ $ this ->clientId = $ clientId ;
71+ $ this ->scopes = $ scopes ;
72+ $ this ->revoked = $ revoked ;
73+ $ this ->createdAt = $ createdAt ;
74+ $ this ->updatedAt = $ updatedAt ;
75+ $ this ->expiresAt = $ expiresAt ;
76+ }
77+
78+ /**
79+ * @return string
80+ */
81+ public function getId (): string
82+ {
83+ return $ this ->id ;
84+ }
85+
86+ /**
87+ * @return string
88+ */
89+ public function getUserId (): string
90+ {
91+ return $ this ->userId ;
92+ }
93+
94+ /**
95+ * @return string
96+ */
97+ public function getClientId (): string
98+ {
99+ return $ this ->clientId ;
100+ }
101+
102+ /**
103+ * @return array
104+ */
105+ public function getScopes (): array
106+ {
107+ return $ this ->scopes ;
108+ }
109+
110+ /**
111+ * @return bool
112+ */
113+ public function isRevoked (): bool
114+ {
115+ return $ this ->revoked ;
116+ }
117+
118+ public function revoke (): void
119+ {
120+ $ this ->revoked = true ;
121+ }
122+
123+ /**
124+ * @return \DateTime
125+ */
126+ public function getCreatedAt (): \DateTime
127+ {
128+ return $ this ->createdAt ;
129+ }
130+
131+ /**
132+ * @return \DateTime
133+ */
134+ public function getUpdatedAt (): \DateTime
135+ {
136+ return $ this ->updatedAt ;
137+ }
138+
139+ /**
140+ * @param \DateTime $updatedAt
141+ */
142+ public function setUpdatedAt (\DateTime $ updatedAt ): void
143+ {
144+ $ this ->updatedAt = $ updatedAt ;
145+ }
146+
147+ /**
148+ * @return \DateTime
149+ */
150+ public function getExpiresAt (): \DateTime
151+ {
152+ return $ this ->expiresAt ;
153+ }
154+ }
0 commit comments