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