Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
4 / 4
CRAP
100.00% covered (success)
100.00%
1 / 1
DomainEventAbstract
100.00% covered (success)
100.00%
4 / 4
100.00% covered (success)
100.00%
4 / 4
4
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getEventId
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getEventName
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getOccurredOn
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getAggregateId
n/a
0 / 0
n/a
0 / 0
0
1<?php
2
3// ╔════════════════════════════════════════════════════════════╗
4// ║ MIT Licence (#Expat) - https://opensource.org/licenses/MIT ║
5// ║ Copyright 2026 Frederic Poeydomenge <dyno@phexium.com>     ║
6// ╚════════════════════════════════════════════════════════════╝
7
8declare(strict_types=1);
9
10namespace Phexium\Domain\Event;
11
12use DateTimeImmutable;
13use Phexium\Domain\Id\IdInterface;
14
15abstract readonly class DomainEventAbstract implements DomainEventInterface
16{
17    public function __construct(
18        private IdInterface $eventId,
19        private DateTimeImmutable $occurredOn,
20    ) {}
21
22    public function getEventId(): IdInterface
23    {
24        return $this->eventId;
25    }
26
27    public function getEventName(): string
28    {
29        return static::class;
30    }
31
32    public function getOccurredOn(): DateTimeImmutable
33    {
34        return $this->occurredOn;
35    }
36
37    abstract public function getAggregateId(): IdInterface;
38}