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