1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace SnifferReport\Model; |
4
|
|
|
|
5
|
|
|
class Message implements \JsonSerializable |
6
|
|
|
{ |
7
|
|
|
private $message; |
8
|
|
|
private $source; |
9
|
|
|
private $severity; |
10
|
|
|
private $type; |
11
|
|
|
private $line; |
12
|
|
|
private $column; |
13
|
|
|
private $fixable; |
14
|
|
|
|
15
|
|
|
public function __construct($message, $source, $severity, $type, $line, $column, $fixable) |
16
|
|
|
{ |
17
|
|
|
$this->setMessage($message); |
18
|
|
|
$this->setSource($source); |
19
|
|
|
$this->setSeverity($severity); |
20
|
|
|
$this->setType($type); |
21
|
|
|
$this->setLine($line); |
22
|
|
|
$this->setColumn($column); |
23
|
|
|
$this->setFixable($fixable); |
24
|
|
|
} |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* @return string |
28
|
|
|
*/ |
29
|
|
|
public function getMessage() |
30
|
|
|
{ |
31
|
|
|
return $this->message; |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @param string $message |
36
|
|
|
*/ |
37
|
|
|
public function setMessage($message) |
38
|
|
|
{ |
39
|
|
|
$this->message = $message; |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @return string |
44
|
|
|
*/ |
45
|
|
|
public function getSource() |
46
|
|
|
{ |
47
|
|
|
return $this->source; |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* @param string $source |
52
|
|
|
*/ |
53
|
|
|
public function setSource($source) |
54
|
|
|
{ |
55
|
|
|
$this->source = $source; |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @return int |
60
|
|
|
*/ |
61
|
|
|
public function getSeverity() |
62
|
|
|
{ |
63
|
|
|
return $this->severity; |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* @param int $severity |
68
|
|
|
*/ |
69
|
|
|
public function setSeverity($severity) |
70
|
|
|
{ |
71
|
|
|
$this->severity = $severity; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* @return string |
76
|
|
|
*/ |
77
|
|
|
public function getType() |
78
|
|
|
{ |
79
|
|
|
return $this->type; |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* @param string $type |
84
|
|
|
*/ |
85
|
|
|
public function setType($type) |
86
|
|
|
{ |
87
|
|
|
$this->type = $type; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* @return int |
92
|
|
|
*/ |
93
|
|
|
public function getLine() |
94
|
|
|
{ |
95
|
|
|
return $this->line; |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* @param int $line |
100
|
|
|
*/ |
101
|
|
|
public function setLine($line) |
102
|
|
|
{ |
103
|
|
|
$this->line = $line; |
104
|
|
|
} |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* @return int |
108
|
|
|
*/ |
109
|
|
|
public function getColumn() |
110
|
|
|
{ |
111
|
|
|
return $this->column; |
112
|
|
|
} |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* @param int $column |
116
|
|
|
*/ |
117
|
|
|
public function setColumn($column) |
118
|
|
|
{ |
119
|
|
|
$this->column = $column; |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* @return boolean |
124
|
|
|
*/ |
125
|
|
|
public function isFixable() |
126
|
|
|
{ |
127
|
|
|
return $this->fixable; |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* @param boolean $fixable |
132
|
|
|
*/ |
133
|
|
|
public function setFixable($fixable) |
134
|
|
|
{ |
135
|
|
|
$this->fixable = $fixable; |
136
|
|
|
} |
137
|
|
|
|
138
|
|
|
/** |
139
|
|
|
* {@inheritdoc} |
140
|
|
|
*/ |
141
|
|
|
public function jsonSerialize() |
142
|
|
|
{ |
143
|
|
|
return [ |
144
|
|
|
'message' => $this->getMessage(), |
145
|
|
|
'source' => $this->getSource(), |
146
|
|
|
'severity' => $this->getSeverity(), |
147
|
|
|
'type' => $this->getType(), |
148
|
|
|
'line' => $this->getLine(), |
149
|
|
|
'column' => $this->getColumn(), |
150
|
|
|
'fixable' => $this->isFixable(), |
151
|
|
|
]; |
152
|
|
|
} |
153
|
|
|
} |
154
|
|
|
|