1 | <?php |
||
30 | final class AccessTokenByReferenceRepository implements AccessTokenRepositoryInterface |
||
31 | { |
||
32 | /** |
||
33 | * @var int |
||
34 | */ |
||
35 | private $lifetime; |
||
36 | |||
37 | /** |
||
38 | * @var int |
||
39 | */ |
||
40 | private $minLength; |
||
41 | |||
42 | /** |
||
43 | * @var int |
||
44 | */ |
||
45 | private $maxLength; |
||
46 | |||
47 | /** |
||
48 | * @var EventStoreInterface |
||
49 | */ |
||
50 | private $eventStore; |
||
51 | |||
52 | /** |
||
53 | * @var RecordsMessages |
||
54 | */ |
||
55 | private $eventRecorder; |
||
56 | |||
57 | /** |
||
58 | * @var AdapterInterface|null |
||
59 | */ |
||
60 | private $cache; |
||
61 | |||
62 | /** |
||
63 | * AccessTokenByReferenceRepository constructor. |
||
64 | * |
||
65 | * @param int $minLength |
||
66 | * @param int $maxLength |
||
67 | * @param int $lifetime |
||
68 | * @param EventStoreInterface $eventStore |
||
69 | * @param RecordsMessages $eventRecorder |
||
70 | */ |
||
71 | public function __construct(int $minLength, int $maxLength, int $lifetime, EventStoreInterface $eventStore, RecordsMessages $eventRecorder) |
||
79 | |||
80 | /** |
||
81 | * @param AdapterInterface $cache |
||
82 | */ |
||
83 | public function enableDomainObjectCaching(AdapterInterface $cache) |
||
87 | |||
88 | /** |
||
89 | * {@inheritdoc} |
||
90 | */ |
||
91 | public function find(AccessTokenId $accessTokenId) |
||
104 | |||
105 | /** |
||
106 | * @param AccessToken $accessToken |
||
107 | */ |
||
108 | public function save(AccessToken $accessToken) |
||
118 | |||
119 | /** |
||
120 | * {@inheritdoc} |
||
121 | */ |
||
122 | public function create(ResourceOwnerId $resourceOwnerId, ClientId $clientId, DataBag $parameters, DataBag $metadatas, array $scopes, ? RefreshTokenId $refreshTokenId, ? ResourceServerId $resourceServerId, ? \DateTimeImmutable $expiresAt): AccessToken |
||
134 | |||
135 | /** |
||
136 | * @param Event[] $events |
||
137 | * |
||
138 | * @return AccessToken |
||
139 | */ |
||
140 | private function getFromEvents(array $events): AccessToken |
||
149 | |||
150 | /** |
||
151 | * @param AccessTokenId $accessTokenId |
||
152 | * |
||
153 | * @return AccessToken|null |
||
154 | */ |
||
155 | private function getFromCache(AccessTokenId $accessTokenId): ? AccessToken |
||
167 | |||
168 | /** |
||
169 | * @param AccessToken $accessToken |
||
170 | */ |
||
171 | private function cacheObject(AccessToken $accessToken) |
||
181 | } |
||
182 |