Total Complexity | 6 |
Total Lines | 52 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
10 | abstract class AggregateRoot implements AggregateRootInterface |
||
11 | { |
||
12 | public const DEFAULT_SEQUENCE_POSITION = 0; |
||
13 | |||
14 | /** @var mixed $aggregateId */ |
||
15 | protected $aggregateId; |
||
16 | |||
17 | /** @var int $versionSequence */ |
||
18 | protected $versionSequence = self::DEFAULT_SEQUENCE_POSITION; // phpcs:ignore |
||
19 | |||
20 | /** @var EventInterface[] $recordedEvents */ |
||
21 | protected $recordedEvents = []; |
||
22 | |||
23 | /** @var EventAccessor $eventAccessor */ |
||
24 | protected $eventAccessor; |
||
25 | |||
26 | /** |
||
27 | * @param mixed $aggregateId |
||
28 | */ |
||
29 | public function setAggregateId($aggregateId) : void |
||
30 | { |
||
31 | $this->aggregateId = $aggregateId; |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * @return mixed |
||
36 | */ |
||
37 | public function getAggregateId() |
||
38 | { |
||
39 | return $this->aggregateId; |
||
40 | } |
||
41 | |||
42 | public function getSequence() : int |
||
43 | { |
||
44 | return $this->versionSequence; |
||
45 | } |
||
46 | |||
47 | public function record(EventInterface $event) : void |
||
48 | { |
||
49 | $this->recordedEvents[] = $event; |
||
50 | } |
||
51 | |||
52 | /** |
||
53 | * @return EventInterface[] |
||
54 | */ |
||
55 | public function getRecordedEvents() : array |
||
58 | } |
||
59 | |||
60 | public function apply(EventInterface $event) : void |
||
62 | } |
||
63 | } |
||
64 |