getEventIdentifier()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 2
Bugs 1 Features 0
Metric Value
c 2
b 1
f 0
dl 4
loc 4
ccs 0
cts 4
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
/*
4
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
5
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
6
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
7
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
8
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
9
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
10
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
11
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
12
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
13
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
14
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15
 *
16
 * The software is based on the Axon Framework project which is
17
 * licensed under the Apache 2.0 license. For more information on the Axon Framework
18
 * see <http://www.axonframework.org/>.
19
 * 
20
 * This software consists of voluntary contributions made by many individuals
21
 * and is licensed under the MIT license. For more information, see
22
 * <http://www.governor-framework.org/>.
23
 */
24
25
namespace Governor\Framework\EventStore\Orm;
26
27
use Governor\Framework\Serializer\SimpleSerializedObject;
28
use Governor\Framework\Serializer\SimpleSerializedType;
29
use Governor\Framework\Serializer\SerializedDomainEventDataInterface;
30
31
/**
32
 * Simple implementation of the {@link SerializedDomainEventDataInterface} interface.
33
 * 
34
 * @author    "David Kalosi" <[email protected]>  
35
 * @license   <a href="http://www.opensource.org/licenses/mit-license.php">MIT License</a> 
36
 */
37 View Code Duplication
class SimpleSerializedDomainEventData implements SerializedDomainEventDataInterface
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
38
{
39
40
    /**
41
     * @var string
42
     */
43
    private $eventIdentifier;
44
45
    /**
46
     * @var string
47
     */
48
    private $aggregateIdentifier;
49
50
    /**
51
     * @var integer
52
     */
53
    private $scn;
54
55
    /**
56
     * @var \DateTime
57
     */
58
    private $timestamp;
59
60
    /**
61
     * @var SimpleSerializedObject
62
     */
63
    private $serializedPayload;
64
65
    /**
66
     * @var SimpleSerializedObject
67
     */
68
    private $serializedMetaData;
69
70
    /**
71
     * Initialize an instance using given properties. This constructor assumes the default SerializedType for meta data
72
     * (name = 'org.axonframework.domain.MetaData' and revision = <em>null</em>).
73
     * <p/>
74
     * Note that the given <code>timestamp</code> must be in a format supported by {@link} DateTime#DateTime(Object)}.
75
     *
76
     * @param string $eventIdentifier     The identifier of the event
77
     * @param string $aggregateIdentifier The identifier of the aggregate
78
     * @param integer $scn      The sequence number of the event
79
     * @param \DateTime $timestamp           The timestamp of the event (format must be supported by {@link
80
     *                            DateTime#DateTime(Object)})
81
     * @param string $payloadType         The type identifier of the serialized payload
82
     * @param string $payloadRevision     The revision of the serialized payload
83
     * @param mixed $payload             The serialized representation of the event
84
     * @param mixed $metaData            The serialized representation of the meta data
85
     */
86
    public function __construct($eventIdentifier, $aggregateIdentifier, $scn,
87
            $timestamp, $payloadType, $payloadRevision, $payload, $metaData)
88
    {
89
        $this->eventIdentifier = $eventIdentifier;
90
        $this->aggregateIdentifier = $aggregateIdentifier;
91
        $this->scn = $scn;
92
        $this->timestamp = $timestamp;
93
        $this->serializedPayload = new SimpleSerializedObject($payload,
94
                new SimpleSerializedType($payloadType, $payloadRevision));
95
        $this->serializedMetaData = new SimpleSerializedObject($metaData,
96
                new SimpleSerializedType('Governor\Framework\Domain\MetaData'));
97
    }
98
99
    public function getEventIdentifier()
100
    {
101
        return $this->eventIdentifier;
102
    }
103
104
    public function getAggregateIdentifier()
105
    {
106
        return $this->aggregateIdentifier;
107
    }
108
109
    public function getScn()
110
    {
111
        return $this->scn;
112
    }
113
114
    public function getTimestamp()
115
    {
116
        return $this->timestamp;
117
    }
118
119
    public function getMetaData()
120
    {
121
        return $this->serializedMetaData;
122
    }
123
124
    public function getPayload()
125
    {
126
        return $this->serializedPayload;
127
    }
128
129
}
130