1 | <?php |
||
29 | final class AuthCodeRepository implements AuthorizationCodeRepository |
||
30 | { |
||
31 | /** |
||
32 | * @var int |
||
33 | */ |
||
34 | private $minLength; |
||
35 | |||
36 | /** |
||
37 | * @var int |
||
38 | */ |
||
39 | private $maxLength; |
||
40 | |||
41 | /** |
||
42 | * @var int |
||
43 | */ |
||
44 | private $lifetime; |
||
45 | |||
46 | /** |
||
47 | * @var MessageBus |
||
48 | */ |
||
49 | private $eventBus; |
||
50 | |||
51 | /** |
||
52 | * @var EventStore |
||
53 | */ |
||
54 | private $eventStore; |
||
55 | |||
56 | /** |
||
57 | * @var AdapterInterface |
||
58 | */ |
||
59 | private $cache; |
||
60 | |||
61 | /** |
||
62 | * AuthCodeRepository 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 create(ClientId $clientId, UserAccountId $userAccountId, array $queryParameters, string $redirectUri, DataBag $parameters, DataBag $metadatas, ? ResourceServerId $resourceServerId): AuthorizationCode |
||
93 | |||
94 | /** |
||
95 | * {@inheritdoc} |
||
96 | */ |
||
97 | public function find(AuthorizationCodeId $authCodeId): ? AuthorizationCode |
||
110 | |||
111 | /** |
||
112 | * @param AuthorizationCode $authCode |
||
113 | */ |
||
114 | public function save(AuthorizationCode $authCode) |
||
124 | |||
125 | /** |
||
126 | * @param Event[] $events |
||
127 | * |
||
128 | * @return AuthorizationCode |
||
129 | */ |
||
130 | private function getFromEvents(array $events): AuthorizationCode |
||
139 | |||
140 | /** |
||
141 | * @param AuthorizationCodeId $authCodeId |
||
142 | * |
||
143 | * @return AuthorizationCode|null |
||
144 | */ |
||
145 | private function getFromCache(AuthorizationCodeId $authCodeId): ? AuthorizationCode |
||
155 | |||
156 | /** |
||
157 | * @param AuthorizationCode $authCode |
||
158 | */ |
||
159 | private function cacheObject(AuthorizationCode $authCode) |
||
167 | } |
||
168 |