1 | <?php |
||
29 | final class AccessTokenByReferenceRepository implements AccessTokenRepository |
||
30 | { |
||
31 | /** |
||
32 | * @var int |
||
33 | */ |
||
34 | private $lifetime; |
||
35 | |||
36 | /** |
||
37 | * @var int |
||
38 | */ |
||
39 | private $minLength; |
||
40 | |||
41 | /** |
||
42 | * @var int |
||
43 | */ |
||
44 | private $maxLength; |
||
45 | |||
46 | /** |
||
47 | * @var EventStore |
||
48 | */ |
||
49 | private $eventStore; |
||
50 | |||
51 | /** |
||
52 | * @var MessageBus |
||
53 | */ |
||
54 | private $eventBus; |
||
55 | |||
56 | /** |
||
57 | * @var AdapterInterface |
||
58 | */ |
||
59 | private $cache; |
||
60 | |||
61 | /** |
||
62 | * AccessTokenByReferenceRepository constructor. |
||
63 | * |
||
64 | * @param int $minLength |
||
65 | * @param int $maxLength |
||
66 | * @param int $lifetime |
||
67 | * @param EventStore $eventStore |
||
68 | * @param MessageBus $eventBus |
||
69 | * @param AdapterInterface $cache |
||
70 | */ |
||
71 | public function __construct(int $minLength, int $maxLength, int $lifetime, EventStore $eventStore, MessageBus $eventBus, AdapterInterface $cache) |
||
80 | |||
81 | /** |
||
82 | * {@inheritdoc} |
||
83 | */ |
||
84 | public function find(AccessTokenId $accessTokenId) |
||
97 | |||
98 | /** |
||
99 | * @param AccessToken $accessToken |
||
100 | */ |
||
101 | public function save(AccessToken $accessToken) |
||
111 | |||
112 | /** |
||
113 | * {@inheritdoc} |
||
114 | */ |
||
115 | public function create(ResourceOwnerId $resourceOwnerId, ClientId $clientId, DataBag $parameters, DataBag $metadatas, ? ResourceServerId $resourceServerId): AccessToken |
||
124 | |||
125 | /** |
||
126 | * @param Event[] $events |
||
127 | * |
||
128 | * @return AccessToken |
||
129 | */ |
||
130 | private function getFromEvents(array $events): AccessToken |
||
139 | |||
140 | /** |
||
141 | * @param AccessTokenId $accessTokenId |
||
142 | * |
||
143 | * @return AccessToken|null |
||
144 | */ |
||
145 | private function getFromCache(AccessTokenId $accessTokenId): ? AccessToken |
||
155 | |||
156 | /** |
||
157 | * @param AccessToken $accessToken |
||
158 | */ |
||
159 | private function cacheObject(AccessToken $accessToken) |
||
167 | } |
||
168 |