SimpleDomainEvent   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 10
c 1
b 0
f 0
dl 0
loc 26
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getRecordedOn() 0 3 1
A getId() 0 3 1
A getPayload() 0 3 1
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