Total Complexity | 4 |
Total Lines | 33 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
11 | trait OrderedEventRegistry |
||
12 | { |
||
13 | /** @var DomainEvent[] */ |
||
14 | private $recordedEvents = []; |
||
15 | |||
16 | /** |
||
17 | * @return DomainEvent[] |
||
18 | * |
||
19 | * @throws IncompatibleClass |
||
20 | */ |
||
21 | public function expelRecordedEvents() : array |
||
22 | { |
||
23 | if ($this instanceof EventAware === false) { |
||
24 | throw IncompatibleClass::forExpellingEvents($this); |
||
25 | } |
||
26 | |||
27 | $recordedEvents = $this->recordedEvents; |
||
28 | |||
29 | $this->recordedEvents = []; |
||
30 | |||
31 | return $recordedEvents; |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * @throws IncompatibleClass |
||
36 | */ |
||
37 | private function triggeredA(DomainEvent $event) : void |
||
44 | } |
||
45 | } |
||
46 |