Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
3 / 3
CRAP
100.00% covered (success)
100.00%
1 / 1
BookDeletedEvent
100.00% covered (success)
100.00%
3 / 3
100.00% covered (success)
100.00%
3 / 3
3
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
 getBook
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 getAggregateId
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
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 AppDemo\Library\Domain\Event;
11
12use AppDemo\Library\Domain\Book;
13use DateTimeImmutable;
14use Phexium\Domain\Event\DomainEventAbstract;
15use Phexium\Domain\Event\DomainEventInterface;
16use Phexium\Domain\Id\IdInterface;
17
18final readonly class BookDeletedEvent extends DomainEventAbstract implements DomainEventInterface
19{
20    public function __construct(
21        IdInterface $eventId,
22        DateTimeImmutable $occurredOn,
23        private Book $book,
24    ) {
25        parent::__construct($eventId, $occurredOn);
26    }
27
28    public function getBook(): Book
29    {
30        return $this->book;
31    }
32
33    public function getAggregateId(): IdInterface
34    {
35        return $this->book->getId();
36    }
37}