1 | <?php |
||
24 | final class AuthCodeRepository implements AuthorizationCodeRepository |
||
25 | { |
||
26 | /** |
||
27 | * @var MessageBus |
||
28 | */ |
||
29 | private $eventBus; |
||
30 | |||
31 | /** |
||
32 | * @var EventStore |
||
33 | */ |
||
34 | private $eventStore; |
||
35 | |||
36 | /** |
||
37 | * @var AdapterInterface |
||
38 | */ |
||
39 | private $cache; |
||
40 | |||
41 | /** |
||
42 | * AuthCodeRepository constructor. |
||
43 | * |
||
44 | * @param EventStore $eventStore |
||
45 | * @param MessageBus $eventBus |
||
46 | * @param AdapterInterface $cache |
||
47 | */ |
||
48 | public function __construct(EventStore $eventStore, MessageBus $eventBus, AdapterInterface $cache) |
||
54 | |||
55 | /** |
||
56 | * {@inheritdoc} |
||
57 | */ |
||
58 | public function find(AuthorizationCodeId $authCodeId): ? AuthorizationCode |
||
71 | |||
72 | /** |
||
73 | * @param AuthorizationCode $authCode |
||
74 | */ |
||
75 | public function save(AuthorizationCode $authCode) |
||
85 | |||
86 | /** |
||
87 | * @param Event[] $events |
||
88 | * |
||
89 | * @return AuthorizationCode |
||
90 | */ |
||
91 | private function getFromEvents(array $events): AuthorizationCode |
||
100 | |||
101 | /** |
||
102 | * @param AuthorizationCodeId $authCodeId |
||
103 | * |
||
104 | * @return AuthorizationCode|null |
||
105 | */ |
||
106 | private function getFromCache(AuthorizationCodeId $authCodeId): ? AuthorizationCode |
||
116 | |||
117 | /** |
||
118 | * @param AuthorizationCode $authCode |
||
119 | */ |
||
120 | private function cacheObject(AuthorizationCode $authCode) |
||
128 | } |
||
129 |