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 Override;
14use Phexium\Domain\Id\IdInterface;
15
16abstract readonly class DomainEventAbstract implements DomainEventInterface
17{
18    public function __construct(
19        private IdInterface $eventId,
20        private DateTimeImmutable $occurredOn,
21    ) {}
22
23    #[Override]
24    public function getEventId(): IdInterface
25    {
26        return $this->eventId;
27    }
28
29    #[Override]
30    public function getEventName(): string
31    {
32        return static::class;
33    }
34
35    #[Override]
36    public function getOccurredOn(): DateTimeImmutable
37    {
38        return $this->occurredOn;
39    }
40
41    abstract public function getAggregateId(): IdInterface;
42}