1 | <?php |
||
8 | abstract class AggregateRoot |
||
9 | { |
||
10 | /** @var string */ |
||
11 | private $aggregateUuid; |
||
12 | |||
13 | /** @var array */ |
||
14 | private $recordedEvents = []; |
||
15 | |||
16 | public static function retrieve(string $uuid): AggregateRoot |
||
24 | |||
25 | public function recordThat(ShouldBeStored $domainEvent): AggregateRoot |
||
33 | |||
34 | public function persist(): AggregateRoot |
||
48 | |||
49 | protected function getStoredEventRepository(): StoredEventRepository |
||
53 | |||
54 | public function getRecordedEvents(): array |
||
58 | |||
59 | private function getAndClearRecordedEvents(): array |
||
67 | |||
68 | private function reconstituteFromEvents(): AggregateRoot |
||
77 | |||
78 | private function apply(ShouldBeStored $event): void |
||
90 | |||
91 | /** |
||
92 | * @param \Spatie\EventProjector\ShouldBeStored|\Spatie\EventProjector\ShouldBeStored[] $events |
||
93 | * |
||
94 | * @return $this |
||
95 | */ |
||
96 | public static function fake($events = []): FakeAggregateRoot |
||
102 | } |
||
103 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: