Completed
Push — master ( 59f7a1...075b21 )
by Daniel
03:25
created

StoredEvent::occurredOn()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace DDDominio\EventSourcing\EventStore;
4
5
use DDDominio\Common\EventInterface;
6
use DDDominio\EventSourcing\Versioning\Version;
7
use DDDominio\EventSourcing\Versioning\VersionableInterface;
8
9
class StoredEvent implements EventInterface, VersionableInterface
10
{
11
    /**
12
     * @var int
13
     */
14
    private $id;
15
16
    /**
17
     * @var string
18
     */
19
    private $streamId;
20
21
    /**
22
     * @var string
23
     */
24
    private $type;
25
26
    /**
27
     * @var string
28
     */
29
    private $data;
30
31
    /**
32
     * @var string
33
     */
34
    private $metadata;
35
36
    /**
37
     * @var \DateTimeImmutable
38
     */
39
    private $occurredOn;
40
41
    /**
42
     * @var Version
43
     */
44
    private $version;
45
46
    /**
47
     * @param int $id
48
     * @param string $streamId
49
     * @param string $type
50
     * @param string $data
51
     * @param string $metadata
52
     * @param \DateTimeImmutable $occurredOn
53
     * @param Version $version
54
     */
55 68
    public function __construct($id, $streamId, $type, $data, $metadata, $occurredOn, $version)
56
    {
57 68
        $this->id = $id;
58 68
        $this->streamId = $streamId;
59 68
        $this->type = $type;
60 68
        $this->data = $data;
61 68
        $this->metadata = $metadata;
62 68
        $this->occurredOn = $occurredOn;
63 68
        $this->version = $version;
64 68
    }
65
66
    /**
67
     * @return int
68
     */
69 4
    public function id()
70
    {
71 4
        return $this->id;
72
    }
73
74
    /**
75
     * @return string
76
     */
77 4
    public function streamId()
78
    {
79 4
        return $this->streamId;
80
    }
81
82
    /**
83
     * @return string
84
     */
85 54
    public function type()
86
    {
87 54
        return $this->type;
88
    }
89
90
    /**
91
     * @param string $type
92
     */
93 2
    public function setType($type)
94
    {
95 2
        $this->type = $type;
96 2
    }
97
98
    /**
99
     * @return string
100
     */
101 57
    public function data()
102
    {
103 57
        return $this->data;
104
    }
105
106
    /**
107
     * @param string $data
108
     */
109 17
    public function setData($data)
110
    {
111 17
        $this->data = $data;
112 17
    }
113
114
    /**
115
     * @return string
116
     */
117 45
    public function metadata()
118
    {
119 45
        return $this->metadata;
120
    }
121
122
    /**
123
     * @return \DateTimeImmutable
124
     */
125 47
    public function occurredOn()
126
    {
127 47
        return $this->occurredOn;
128
    }
129
130
    /**
131
     * @return Version
132
     */
133 53
    public function version()
134
    {
135 53
        return $this->version;
136
    }
137
138
    /**
139
     * @param Version $version
140
     */
141 13
    public function setVersion($version)
142
    {
143 13
        $this->version = $version;
144 13
    }
145
}
146