Completed
Pull Request — master (#2)
by Ronaldo
01:31
created

BaseEvent::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
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 WSW\SiftScience\Events;
4
5
use DateTime;
6
7
/**
8
 * Class BaseEvent
9
 *
10
 * @package WSW\SiftScience\Events
11
 * @author Ronaldo Matos Rodrigues <[email protected]>
12
 */
13
abstract class BaseEvent
14
{
15
    /**
16
     * @var string
17
     */
18
    protected $type;
19
20
    /**
21
     * @var string
22
     */
23
    protected $apiKey;
24
25
    /**
26
     * @var string
27
     */
28
    protected $userId;
29
30
    /**
31
     * @var string
32
     */
33
    protected $sessionId;
34
35
    /**
36
     * @var string
37
     */
38
    protected $ip;
39
40
    /**
41
     * @var \DateTime
42
     */
43
    protected $time;
44
45
    /**
46
     * BaseEvent constructor.
47
     */
48 36
    public function __construct()
49
    {
50 36
        $this->time = new DateTime();
51 36
    }
52
53
    /**
54
     * @return string
55
     */
56 16
    public function getType()
57
    {
58 16
        return $this->type;
59
    }
60
61
    /**
62
     * @return string
63
     */
64 14
    public function getApiKey()
65
    {
66 14
        return $this->apiKey;
67
    }
68
69
    /**
70
     * @param string $apiKey
71
     *
72
     * @return $this
73
     */
74 14
    public function setApiKey($apiKey)
75
    {
76 14
        $this->apiKey = $apiKey;
77
78 14
        return $this;
79
    }
80
81
    /**
82
     * @return string
83
     */
84 14
    public function getUserId()
85
    {
86 14
        return $this->userId;
87
    }
88
89
    /**
90
     * @param string $userId
91
     *
92
     * @return $this
93
     */
94 1
    public function setUserId($userId)
95
    {
96 1
        $this->userId = $userId;
97
98 1
        return $this;
99
    }
100
101
    /**
102
     * @return string
103
     */
104 12
    public function getSessionId()
105
    {
106 12
        return $this->sessionId;
107
    }
108
109
    /**
110
     * @param string $sessionId
111
     *
112
     * @return $this
113
     */
114 1
    public function setSessionId($sessionId)
115
    {
116 1
        $this->sessionId = $sessionId;
117
118 1
        return $this;
119
    }
120
121
    /**
122
     * @return string
123
     */
124 14
    public function getIp()
125
    {
126 14
        return $this->ip;
127
    }
128
129
    /**
130
     * @param string $ip
131
     *
132
     * @return $this
133
     */
134 1
    public function setIp($ip)
135
    {
136 1
        $this->ip = $ip;
137
138 1
        return $this;
139
    }
140
141
    /**
142
     * @return \DateTime
143
     */
144 14
    public function getTime()
145
    {
146 14
        return $this->time;
147
    }
148
149
    /**
150
     * @param \DateTime $time
151
     *
152
     * @return $this
153
     */
154 1
    public function setTime(DateTime $time)
155
    {
156 1
        $this->time = $time;
157
158 1
        return $this;
159
    }
160
}
161