Total Complexity | 4 |
Total Lines | 33 |
Duplicated Lines | 0 % |
Coverage | 100% |
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 | 3 | public function expelRecordedEvents() : array |
|
22 | { |
||
23 | 3 | if ($this instanceof EventAware === false) { |
|
24 | 1 | throw IncompatibleClass::forExpellingEvents($this); |
|
25 | } |
||
26 | |||
27 | 2 | $recordedEvents = $this->recordedEvents; |
|
28 | |||
29 | 2 | $this->recordedEvents = []; |
|
30 | |||
31 | 2 | return $recordedEvents; |
|
32 | } |
||
33 | |||
34 | /** |
||
35 | * @throws IncompatibleClass |
||
36 | */ |
||
37 | 2 | private function triggeredA(DomainEvent $event) : void |
|
44 | 1 | } |
|
45 | } |
||
46 |