Total Complexity | 4 |
Total Lines | 37 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 5 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
11 | trait SnapshottingBehaviour |
||
12 | { |
||
13 | /** |
||
14 | * @var positive-int|0 |
||
|
|||
15 | */ |
||
16 | private int $aggregateRootVersion = 0; |
||
17 | |||
18 | abstract public function aggregateRootVersion(): int; |
||
19 | |||
20 | abstract public function aggregateRootId(): AggregateRootId; |
||
21 | |||
22 | abstract protected function apply(object $event): void; |
||
23 | |||
24 | 1 | public function createSnapshot(): Snapshot |
|
27 | } |
||
28 | |||
29 | abstract protected function createSnapshotState(): mixed; |
||
30 | |||
31 | public static function reconstituteFromSnapshotAndEvents(Snapshot $snapshot, Generator $events): static |
||
45 | 1 | } |
|
46 | |||
47 | 1 | abstract protected static function reconstituteFromSnapshotState(AggregateRootId $id, $state): AggregateRootWithSnapshotting; |
|
48 | } |
||
49 |