SimpleDomainEvent::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 3
1
<?php declare(strict_types=1);
2
namespace Kepawni\Twilted\Basic;
3
4
use DateTimeInterface;
5
use Kepawni\Twilted\DomainEvent;
6
use Kepawni\Twilted\EntityIdentifier;
7
use Kepawni\Twilted\EventPayload;
8
9
/**
10
 * An event that occurred on an aggregate at a time in the past loaded with an EventPayload carrying the details.
11
 */
12
class SimpleDomainEvent implements DomainEvent
13
{
14
    private $entityId;
15
    private $payload;
16
    private $recordedOn;
17
18
    public function __construct(EventPayload $payload, EntityIdentifier $entityId, DateTimeInterface $recordedOn)
19
    {
20
        $this->payload = $payload;
21
        $this->entityId = $entityId;
22
        $this->recordedOn = $recordedOn;
23
    }
24
25
    public function getId(): EntityIdentifier
26
    {
27
        return $this->entityId;
28
    }
29
30
    public function getPayload(): EventPayload
31
    {
32
        return $this->payload;
33
    }
34
35
    public function getRecordedOn(): DateTimeInterface
36
    {
37
        return $this->recordedOn;
38
    }
39
}
40