| Conditions | 3 |
| Paths | 2 |
| Total Lines | 12 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 4 |
| CRAP Score | 3 |
| Changes | 4 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 61 | public static function reconstituteFromEvents(AggregateRootId $aggregateRootId, Generator $events): static |
||
| 62 | { |
||
| 63 | 14 | $aggregateRoot = new static($aggregateRootId); |
|
| 64 | |||
| 65 | 14 | /** @var object $event */ |
|
| 66 | 14 | foreach ($events as $event) { |
|
| 67 | $aggregateRoot->apply($event); |
||
| 68 | 14 | } |
|
| 69 | |||
| 70 | $aggregateRoot->aggregateRootVersion = $events->getReturn() ?: 0; |
||
| 71 | |||
| 72 | return $aggregateRoot; |
||
| 73 | } |
||
| 75 |