| Total Complexity | 4 |
| Total Lines | 50 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 23 | final class GenericSnapshot implements Snapshot |
||
| 24 | { |
||
| 25 | /** |
||
| 26 | * @var StoreStream |
||
| 27 | */ |
||
| 28 | private $stream; |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @var AggregateRoot |
||
| 32 | */ |
||
| 33 | private $aggregateRoot; |
||
| 34 | |||
| 35 | /** |
||
| 36 | * GenericSnapshot constructor. |
||
| 37 | * |
||
| 38 | * @param StoreStream $stream |
||
| 39 | * @param AggregateRoot $aggregateRoot |
||
| 40 | */ |
||
| 41 | private function __construct(StoreStream $stream, AggregateRoot $aggregateRoot) |
||
| 42 | { |
||
| 43 | $this->stream = $stream; |
||
| 44 | $this->aggregateRoot = $aggregateRoot; |
||
| 45 | } |
||
| 46 | |||
| 47 | /** |
||
| 48 | * Create from aggregateRoot. |
||
| 49 | * |
||
| 50 | * @param AggregateRoot $aggregateRoot |
||
| 51 | * |
||
| 52 | * @return self |
||
| 53 | */ |
||
| 54 | public static function fromAggregateRoot(AggregateRoot $aggregateRoot): self |
||
| 55 | { |
||
| 56 | return new self(GenericStoreStream::fromAggregateRoot($aggregateRoot), $aggregateRoot); |
||
| 57 | } |
||
| 58 | |||
| 59 | /** |
||
| 60 | * {@inheritdoc} |
||
| 61 | */ |
||
| 62 | public function getStoreStream(): StoreStream |
||
| 65 | } |
||
| 66 | |||
| 67 | /** |
||
| 68 | * {@inheritdoc} |
||
| 69 | */ |
||
| 70 | public function getAggregateRoot(): AggregateRoot |
||
| 73 | } |
||
| 74 | } |
||
| 75 |