Passed
Push — feature/depend-on-metadata-inf... ( ef854e...953c11 )
by
unknown
39:13 queued 32:26
created

ErrorLog   A

Complexity

Total Complexity 18

Size/Duplication

Total Lines 209
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 40
dl 0
loc 209
ccs 0
cts 81
cp 0
rs 10
c 0
b 0
f 0
wmc 18

17 Methods

Rating   Name   Duplication   Size   Complexity  
A getDateCreated() 0 3 1
A __toString() 0 4 2
A getUa() 0 3 1
A getIp() 0 3 1
A setUrl() 0 4 1
A getMessage() 0 3 1
A __construct() 0 9 1
A getReferer() 0 3 1
A getUrl() 0 3 1
A setStatus() 0 4 1
A getStatus() 0 3 1
A setIp() 0 4 1
A setDateCreated() 0 4 1
A setReferer() 0 4 1
A setUa() 0 4 1
A getId() 0 3 1
A setMessage() 0 4 1
1
<?php
2
/**
3
 * @copyright Zicht Online <http://zicht.nl>
4
 */
5
namespace Zicht\Bundle\UrlBundle\Entity;
6
7
use Doctrine\ORM\Mapping as ORM;
8
9
/**
10
 * Log entries
11
 *
12
 * @ORM\Entity
13
 * @ORM\Table(name="url_error_log")
14
 */
15
class ErrorLog
16
{
17
    /**
18
     * @ORM\GeneratedValue(strategy="AUTO")
19
     * @ORM\Id
20
     * @ORM\Column(type="integer")
21
     */
22
    protected $id;
23
24
    /**
25
     * @ORM\Column(type="integer", nullable=true)
26
     */
27
    protected $status;
28
29
    /**
30
     * @ORM\Column(type="string", length=1024, nullable=true)
31
     */
32
    protected $url;
33
34
    /**
35
     * @ORM\Column(type="string", length=255)
36
     */
37
    protected $ip;
38
39
    /**
40
     * @ORM\Column(type="string", length=1024)
41
     */
42
    protected $ua;
43
44
    /**
45
     * @ORM\Column(type="string", nullable=true)
46
     */
47
    protected $message;
48
49
    /**
50
     * @ORM\Column(type="string", nullable=true)
51
     */
52
    protected $referer;
53
54
    /**
55
     * @ORM\Column(type="datetime", nullable=true)
56
     */
57
    protected $date_created;
58
59
60
    /**
61
     * Create the log entry
62
     *
63
     * @param string $message
64
     * @param \DateTime $date_created
65
     * @param string $referer
66
     * @param string $ua
67
     * @param string $ip
68
     * @param string $url
69
     */
70
    public function __construct($message, $date_created, $referer, $ua, $ip, $url)
71
    {
72
        $this
73
            ->setMessage($message)
74
            ->setDateCreated($date_created)
75
            ->setReferer($referer)
76
            ->setUa($ua)
77
            ->setIp($ip)
78
            ->setUrl($url);
79
    }
80
81
82
    /**
83
     * @return mixed
84
     */
85
    public function getId()
86
    {
87
        return $this->id;
88
    }
89
90
91
    /**
92
     * @return string
93
     */
94
    public function __toString()
95
    {
96
        return (string)$this->message
97
            . ' @ ' . (string)($this->date_created ? $this->date_created->format('YmdHis') : '');
98
    }
99
100
    /**
101
     * @param \DateTime $date_created
102
     * @return ErrorLog
103
     */
104
    public function setDateCreated($date_created)
105
    {
106
        $this->date_created = $date_created;
107
        return $this;
108
    }
109
110
    /**
111
     * @return mixed
112
     */
113
    public function getDateCreated()
114
    {
115
        return $this->date_created;
116
    }
117
118
    /**
119
     * @param string $ip
120
     * @return self
121
     */
122
    public function setIp($ip)
123
    {
124
        $this->ip = $ip;
125
        return $this;
126
    }
127
128
    /**
129
     * @return mixed
130
     */
131
    public function getIp()
132
    {
133
        return $this->ip;
134
    }
135
136
    /**
137
     * @param string $message
138
     * @return self
139
     */
140
    public function setMessage($message)
141
    {
142
        $this->message = $message;
143
        return $this;
144
    }
145
146
    /**
147
     * @return mixed
148
     */
149
    public function getMessage()
150
    {
151
        return $this->message;
152
    }
153
154
    /**
155
     * @param string $referer
156
     * @return self
157
     */
158
    public function setReferer($referer)
159
    {
160
        $this->referer = $referer;
161
        return $this;
162
    }
163
164
    /**
165
     * @return mixed
166
     */
167
    public function getReferer()
168
    {
169
        return $this->referer;
170
    }
171
172
    /**
173
     * @param int $status
174
     * @return self
175
     */
176
    public function setStatus($status)
177
    {
178
        $this->status = $status;
179
        return $this;
180
    }
181
182
    /**
183
     * @return mixed
184
     */
185
    public function getStatus()
186
    {
187
        return $this->status;
188
    }
189
190
    /**
191
     * @param string $ua
192
     * @return self
193
     */
194
    public function setUa($ua)
195
    {
196
        $this->ua = $ua;
197
        return $this;
198
    }
199
200
    /**
201
     * @return mixed
202
     */
203
    public function getUa()
204
    {
205
        return $this->ua;
206
    }
207
208
    /**
209
     * @param string $url
210
     * @return self
211
     */
212
    public function setUrl($url)
213
    {
214
        $this->url = $url;
215
        return $this;
216
    }
217
218
    /**
219
     * @return mixed
220
     */
221
    public function getUrl()
222
    {
223
        return $this->url;
224
    }
225
}
226