Conditions | 2 |
Paths | 2 |
Total Lines | 12 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
40 | 8 | public static function reconstituteFromEvents(AggregateRootId $aggregateRootId, Generator $events): AggregateRoot |
|
41 | { |
||
42 | 8 | $aggregateRoot = new static($aggregateRootId); |
|
43 | |||
44 | /** @var Event $event */ |
||
45 | 8 | foreach ($events as $event) { |
|
46 | 2 | $aggregateRoot->apply($event); |
|
47 | 2 | $aggregateRoot->aggregateRootVersion++; |
|
48 | } |
||
49 | |||
50 | 8 | return $aggregateRoot; |
|
51 | } |
||
52 | |||
54 | } |