GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

UserActionEntity   A
last analyzed

Complexity

Total Complexity 22

Size/Duplication

Total Lines 291
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 0

Importance

Changes 0
Metric Value
wmc 22
lcom 2
cbo 0
dl 0
loc 291
rs 10
c 0
b 0
f 0

21 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 0 4 1
A setId() 0 6 1
A getKey() 0 4 1
A setKey() 0 6 1
A getMessage() 0 4 1
A setMessage() 0 6 1
A getData() 0 4 1
A setData() 0 13 2
A getIp() 0 4 1
A setIp() 0 6 1
A getUserAgent() 0 4 1
A setUserAgent() 0 6 1
A getTimeCreated() 0 4 1
A setTimeCreated() 0 6 1
A getTimeUpdated() 0 4 1
A setTimeUpdated() 0 6 1
A getUser() 0 4 1
A setUser() 0 6 1
A toArray() 0 9 1
A preUpdate() 0 4 1
A prePersist() 0 5 1
1
<?php
2
3
namespace Application\Entity;
4
5
use Doctrine\ORM\Mapping as ORM;
6
7
/**
8
 * User action Entity.
9
 *
10
 * @ORM\Table(name="user_actions")
11
 * @ORM\Entity(repositoryClass="Application\Repository\UserActionRepository")
12
 * @ORM\HasLifecycleCallbacks()
13
 *
14
 * @author Borut Balažek <[email protected]>
15
 */
16
class UserActionEntity
17
{
18
    /**
19
     * @var int
20
     *
21
     * @ORM\Column(name="id", type="integer")
22
     * @ORM\Id
23
     * @ORM\GeneratedValue(strategy="IDENTITY")
24
     */
25
    protected $id;
26
27
    /**
28
     * @var string
29
     *
30
     * @ORM\Column(name="`key`", type="text", nullable=true)
31
     */
32
    protected $key;
33
34
    /**
35
     * @var string
36
     *
37
     * @ORM\Column(name="message", type="text", nullable=true)
38
     */
39
    protected $message;
40
41
    /**
42
     * @var string
43
     *
44
     * @ORM\Column(name="data", type="text", nullable=true)
45
     */
46
    protected $data;
47
48
    /**
49
     * @var string
50
     *
51
     * @ORM\Column(name="ip", type="string", length=255, nullable=true)
52
     */
53
    protected $ip;
54
55
    /**
56
     * @var string
57
     *
58
     * @ORM\Column(name="user_agent", type="text", nullable=true)
59
     */
60
    protected $userAgent;
61
62
    /**
63
     * @var \DateTime
64
     *
65
     * @ORM\Column(name="time_created", type="datetime")
66
     */
67
    protected $timeCreated;
68
69
    /**
70
     * @var \DateTime
71
     *
72
     * @ORM\Column(name="time_updated", type="datetime")
73
     */
74
    protected $timeUpdated;
75
76
    /**
77
     * @ORM\ManyToOne(targetEntity="Application\Entity\UserEntity", inversedBy="userActions")
78
     */
79
    protected $user;
80
81
    /*** Id ***/
82
    /**
83
     * @return int
84
     */
85
    public function getId()
86
    {
87
        return $this->id;
88
    }
89
90
    /**
91
     * @param $id
92
     *
93
     * @return UserActionEntity
94
     */
95
    public function setId($id)
96
    {
97
        $this->id = $id;
98
99
        return $this;
100
    }
101
102
    /*** Key ***/
103
    /**
104
     * @return string
105
     */
106
    public function getKey()
107
    {
108
        return $this->key;
109
    }
110
111
    /**
112
     * @param $key
113
     *
114
     * @return UserActionEntity
115
     */
116
    public function setKey($key)
117
    {
118
        $this->key = $key;
119
120
        return $this;
121
    }
122
123
    /*** Message ***/
124
    /**
125
     * @return string
126
     */
127
    public function getMessage()
128
    {
129
        return $this->message;
130
    }
131
132
    /**
133
     * @param $message
134
     *
135
     * @return UserActionEntity
136
     */
137
    public function setMessage($message)
138
    {
139
        $this->message = $message;
140
141
        return $this;
142
    }
143
144
    /*** Data ***/
145
    /**
146
     * @return string
147
     */
148
    public function getData()
149
    {
150
        return $this->data;
151
    }
152
153
    /**
154
     * @param $data
155
     *
156
     * @return UserActionEntity
157
     */
158
    public function setData($data)
159
    {
160
        if (is_array($data)) {
161
            $data = json_encode($data);
162
163
            $data = str_replace("\u0000*", '', $data);
164
            $data = str_replace("\u0000", '', $data);
165
        }
166
167
        $this->data = $data;
168
169
        return $this;
170
    }
171
172
    /*** IP ***/
173
    /**
174
     * @return string
175
     */
176
    public function getIp()
177
    {
178
        return $this->ip;
179
    }
180
181
    /**
182
     * @param $ip
183
     *
184
     * @return UserActionEntity
185
     */
186
    public function setIp($ip)
187
    {
188
        $this->ip = $ip;
189
190
        return $this;
191
    }
192
193
    /*** User agent ***/
194
    /**
195
     * @return string
196
     */
197
    public function getUserAgent()
198
    {
199
        return $this->userAgent;
200
    }
201
202
    /**
203
     * @param $userAgent
204
     *
205
     * @return UserActionEntity
206
     */
207
    public function setUserAgent($userAgent)
208
    {
209
        $this->userAgent = $userAgent;
210
211
        return $this;
212
    }
213
214
    /*** Time created ***/
215
    /**
216
     * @return \DateTime
217
     */
218
    public function getTimeCreated()
219
    {
220
        return $this->timeCreated;
221
    }
222
223
    /**
224
     * @param \DateTime $timeCreated
225
     *
226
     * @return UserActionEntity
227
     */
228
    public function setTimeCreated(\DateTime $timeCreated)
229
    {
230
        $this->timeCreated = $timeCreated;
231
232
        return $this;
233
    }
234
235
    /*** Time updated ***/
236
    /**
237
     * @return \DateTime
238
     */
239
    public function getTimeUpdated()
240
    {
241
        return $this->timeUpdated;
242
    }
243
244
    /**
245
     * @param \DateTime $timeUpdated
246
     *
247
     * @return UserActionEntity
248
     */
249
    public function setTimeUpdated(\DateTime $timeUpdated)
250
    {
251
        $this->timeUpdated = $timeUpdated;
252
253
        return $this;
254
    }
255
256
    /*** User ***/
257
    /**
258
     * @return UserEntity $user
259
     */
260
    public function getUser()
261
    {
262
        return $this->user;
263
    }
264
265
    /**
266
     * @param UserEntity $user
267
     *
268
     * @return UserActionEntity
269
     */
270
    public function setUser(UserEntity $user = null)
271
    {
272
        $this->user = $user;
273
274
        return $this;
275
    }
276
277
    /**
278
     * @return array
279
     */
280
    public function toArray()
281
    {
282
        return array(
283
            'id' => $this->getId(),
284
            'key' => $this->getKey(),
285
            'ip' => $this->getIp(),
286
            'time_created' => $this->getTimeCreated()->format(DATE_ATOM),
287
        );
288
    }
289
290
    /**
291
     * @ORM\PreUpdate
292
     */
293
    public function preUpdate()
294
    {
295
        $this->setTimeUpdated(new \DateTime('now'));
296
    }
297
298
    /**
299
     * @ORM\PrePersist
300
     */
301
    public function prePersist()
302
    {
303
        $this->setTimeUpdated(new \DateTime('now'));
304
        $this->setTimeCreated(new \DateTime('now'));
305
    }
306
}
307