GemberPHP /
event-sourcing
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace Gember\EventSourcing\UseCase; |
||
| 6 | |||
| 7 | use DateTimeImmutable; |
||
| 8 | |||
| 9 | final readonly class DomainEventEnvelope |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @param list<string> $domainTags |
||
| 13 | */ |
||
| 14 | 16 | public function __construct( |
|
| 15 | public string $eventId, |
||
| 16 | public array $domainTags, |
||
| 17 | public object $event, |
||
| 18 | public Metadata $metadata, |
||
| 19 | public DateTimeImmutable $appliedAt, |
||
| 20 | 16 | ) {} |
|
| 21 | |||
| 22 | 1 | public function withMetadata(Metadata $metadata): self |
|
| 23 | { |
||
| 24 | 1 | return new self( |
|
| 25 | 1 | $this->eventId, |
|
| 26 | 1 | $this->domainTags, |
|
| 27 | 1 | $this->event, |
|
| 28 | 1 | $metadata, |
|
| 29 | 1 | $this->appliedAt, |
|
| 30 | 1 | ); |
|
| 31 | } |
||
| 32 | } |
||
| 33 |