StoredEvent::data()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

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
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 77
    public function __construct($id, $streamId, $type, $data, $metadata, $occurredOn, $version)
56
    {
57 77
        $this->id = $id;
58 77
        $this->streamId = $streamId;
59 77
        $this->type = $type;
60 77
        $this->data = $data;
61 77
        $this->metadata = $metadata;
62 77
        $this->occurredOn = $occurredOn;
63 77
        $this->version = $version;
64 77
    }
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 63
    public function type()
86
    {
87 63
        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 66
    public function data()
102
    {
103 66
        return $this->data;
104
    }
105
106
    /**
107
     * @param string $data
108
     */
109 18
    public function setData($data)
110
    {
111 18
        $this->data = $data;
112 18
    }
113
114
    /**
115
     * @return string
116
     */
117 54
    public function metadata()
118
    {
119 54
        return $this->metadata;
120
    }
121
122
    /**
123
     * @return \DateTimeImmutable
124
     */
125 56
    public function occurredOn()
126
    {
127 56
        return $this->occurredOn;
128
    }
129
130
    /**
131
     * @return Version
132
     */
133 62
    public function version()
134
    {
135 62
        return $this->version;
136
    }
137
138
    /**
139
     * @param Version $version
140
     */
141 14
    public function setVersion($version)
142
    {
143 14
        $this->version = $version;
144 14
    }
145
}
146