Failed Conditions
Push — master ( 9f23c0...1448ca )
by Adrien
07:45
created

Log::setIp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 0
cts 2
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Application\Model;
6
7
use Doctrine\ORM\Mapping as ORM;
8
9
/**
10
 * Log
11
 *
12
 * @ORM\Table(indexes={
13
 *     @ORM\Index(name="priority", columns={"creation_date"}),
14
 *     @ORM\Index(name="date_created", columns={"creation_date"}),
15
 *     @ORM\Index(name="message", columns={"message"})
16
 * })
17
 * @ORM\Entity(repositoryClass="Application\Repository\LogRepository")
18
 */
19
class Log extends AbstractModel
20
{
21
    use \Application\Traits\HasUrl;
22
23
    /**
24
     * @var int
25
     *
26
     * @ORM\Column(type="smallint")
27
     */
28
    private $priority;
29
30
    /**
31
     * @var string
32
     *
33
     * @ORM\Column(type="string", length=5000, nullable=false)
34
     */
35
    private $message;
36
37
    /**
38
     * @var string
39
     *
40
     * @ORM\Column(type="string", length=500, nullable=false)
41
     */
42
    private $referer;
43
44
    /**
45
     * @var string
46
     *
47
     * @ORM\Column(type="string", length=1000, nullable=false)
48
     */
49
    private $request;
50
51
    /**
52
     * @var string
53
     *
54
     * @ORM\Column(type="string", length=40, nullable=false)
55
     */
56
    private $ip;
57
58
    /**
59
     * The statistics data
60
     *
61
     * @var array
62
     * @ORM\Column(type="json_array")
63
     */
64
    private $extra = [];
65
66
    /**
67
     * Set priority
68
     *
69
     * @param int $priority
70
     */
71
    public function setPriority(int $priority): void
72
    {
73
        $this->priority = $priority;
74
    }
75
76
    /**
77
     * Get priority
78
     *
79
     * @return int
80
     */
81
    public function getPriority(): int
82
    {
83
        return $this->priority;
84
    }
85
86
    /**
87
     * Set message
88
     *
89
     * @param string $message
90
     */
91
    public function setMessage(string $message): void
92
    {
93
        $this->message = $message;
94
    }
95
96
    /**
97
     * Get message
98
     *
99
     * @return string
100
     */
101
    public function getMessage(): string
102
    {
103
        return $this->message;
104
    }
105
106
    /**
107
     * Set referer
108
     *
109
     * @param string $referer
110
     */
111
    public function setReferer(string $referer): void
112
    {
113
        $this->referer = $referer;
114
    }
115
116
    /**
117
     * Get referer
118
     *
119
     * @return string
120
     */
121
    public function getReferer(): string
122
    {
123
        return $this->referer;
124
    }
125
126
    /**
127
     * Set request
128
     *
129
     * @param string $request
130
     */
131
    public function setRequest(string $request): void
132
    {
133
        $this->request = $request;
134
    }
135
136
    /**
137
     * Get request
138
     *
139
     * @return string
140
     */
141
    public function getRequest(): string
142
    {
143
        return $this->request;
144
    }
145
146
    /**
147
     * Set ip
148
     *
149
     * @param string $ip
150
     */
151
    public function setIp(string $ip): void
152
    {
153
        $this->ip = $ip;
154
    }
155
156
    /**
157
     * Get ip
158
     *
159
     * @return string
160
     */
161
    public function getIp(): string
162
    {
163
        return $this->ip;
164
    }
165
166
    /**
167
     * @return array
168
     */
169
    public function getExtra(): array
170
    {
171
        return $this->extra;
172
    }
173
174
    /**
175
     * @param array $extra
176
     */
177
    public function setExtra(array $extra): void
178
    {
179
        $this->extra = $extra;
180
    }
181
}
182