|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* Plugin Abstract |
|
5
|
|
|
* |
|
6
|
|
|
* PHP Version 5.3.0 |
|
7
|
|
|
* |
|
8
|
|
|
* Copyright (c) 2007-2010, Mayflower GmbH |
|
9
|
|
|
* All rights reserved. |
|
10
|
|
|
* |
|
11
|
|
|
* Redistribution and use in source and binary forms, with or without |
|
12
|
|
|
* modification, are permitted provided that the following conditions |
|
13
|
|
|
* are met: |
|
14
|
|
|
* |
|
15
|
|
|
* * Redistributions of source code must retain the above copyright |
|
16
|
|
|
* notice, this list of conditions and the following disclaimer. |
|
17
|
|
|
* |
|
18
|
|
|
* * Redistributions in binary form must reproduce the above copyright |
|
19
|
|
|
* notice, this list of conditions and the following disclaimer in |
|
20
|
|
|
* the documentation and/or other materials provided with the |
|
21
|
|
|
* distribution. |
|
22
|
|
|
* |
|
23
|
|
|
* * Neither the name of Mayflower GmbH nor the names of his |
|
24
|
|
|
* contributors may be used to endorse or promote products derived |
|
25
|
|
|
* from this software without specific prior written permission. |
|
26
|
|
|
* |
|
27
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
28
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
29
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
|
30
|
|
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
|
31
|
|
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
|
32
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
|
33
|
|
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
|
34
|
|
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
|
35
|
|
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
36
|
|
|
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
|
37
|
|
|
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
38
|
|
|
* POSSIBILITY OF SUCH DAMAGE. |
|
39
|
|
|
* |
|
40
|
|
|
* @category PHP_CodeBrowser |
|
41
|
|
|
* |
|
42
|
|
|
* @author Elger Thiele <[email protected]> |
|
43
|
|
|
* @author Michel Hartmann <[email protected]> |
|
44
|
|
|
* |
|
45
|
|
|
* @copyright 2007-2010 Mayflower GmbH |
|
46
|
|
|
* |
|
47
|
|
|
* @license http://www.opensource.org/licenses/bsd-license.php BSD License |
|
48
|
|
|
* |
|
49
|
|
|
* @version SVN: $Id$ |
|
50
|
|
|
* |
|
51
|
|
|
* @link http://www.phpunit.de/ |
|
52
|
|
|
* |
|
53
|
|
|
* @since File available since 0.1.2 |
|
54
|
|
|
*/ |
|
55
|
|
|
|
|
56
|
|
|
namespace PHPCodeBrowser; |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* Issue |
|
60
|
|
|
* |
|
61
|
|
|
* Object Model for issues. |
|
62
|
|
|
* This object is used for working with common issues types. |
|
63
|
|
|
* |
|
64
|
|
|
* @category PHP_CodeBrowser |
|
65
|
|
|
* |
|
66
|
|
|
* @author Elger Thiele <[email protected]> |
|
67
|
|
|
* @author Michel Hartmann <[email protected]> |
|
68
|
|
|
* |
|
69
|
|
|
* @copyright 2007-2010 Mayflower GmbH |
|
70
|
|
|
* |
|
71
|
|
|
* @license http://www.opensource.org/licenses/bsd-license.php BSD License |
|
72
|
|
|
* |
|
73
|
|
|
* @version Release: @package_version@ |
|
74
|
|
|
* |
|
75
|
|
|
* @link http://github.com/mayflowergmbh |
|
76
|
|
|
* |
|
77
|
|
|
* @since Class available since 0.1.2 |
|
78
|
|
|
*/ |
|
79
|
|
|
class Issue |
|
80
|
|
|
{ |
|
81
|
|
|
/** |
|
82
|
|
|
* Source file name. |
|
83
|
|
|
* |
|
84
|
|
|
* @var string |
|
85
|
|
|
*/ |
|
86
|
|
|
private $fileName; |
|
87
|
|
|
|
|
88
|
|
|
/** |
|
89
|
|
|
* Starting Line of the Issue. |
|
90
|
|
|
* |
|
91
|
|
|
* @var int |
|
92
|
|
|
*/ |
|
93
|
|
|
private $lineStart; |
|
94
|
|
|
|
|
95
|
|
|
/** |
|
96
|
|
|
* Ending Line of the Issue. |
|
97
|
|
|
* |
|
98
|
|
|
* @var int |
|
99
|
|
|
*/ |
|
100
|
|
|
private $lineEnd; |
|
101
|
|
|
|
|
102
|
|
|
/** |
|
103
|
|
|
* Name of the Plugin that found the Issue. |
|
104
|
|
|
* It is also used for CSS class definitions. |
|
105
|
|
|
* |
|
106
|
|
|
* @var string |
|
107
|
|
|
*/ |
|
108
|
|
|
private $foundBy; |
|
109
|
|
|
|
|
110
|
|
|
/** |
|
111
|
|
|
* Issue Description text. |
|
112
|
|
|
* |
|
113
|
|
|
* @var string |
|
114
|
|
|
*/ |
|
115
|
|
|
private $description; |
|
116
|
|
|
|
|
117
|
|
|
/** |
|
118
|
|
|
* Severity of the issue. |
|
119
|
|
|
* |
|
120
|
|
|
* @var string |
|
121
|
|
|
*/ |
|
122
|
|
|
private $severity; |
|
123
|
|
|
|
|
124
|
|
|
/** |
|
125
|
|
|
* Default constructor |
|
126
|
|
|
* |
|
127
|
|
|
* @param string $fileName The source file name the issue was found in. |
|
128
|
|
|
* @param int $lineStart The starting line of the issue. |
|
129
|
|
|
* @param int $lineEnd The ending line of registered issue. |
|
130
|
|
|
* @param string $foundBy The plugin name definition. |
|
131
|
|
|
* @param string $description The description of the issue. |
|
132
|
|
|
* @param string $severity |
|
133
|
|
|
*/ |
|
134
|
|
|
public function __construct(string $fileName, int $lineStart, int $lineEnd, string $foundBy, string $description, string $severity) |
|
135
|
|
|
{ |
|
136
|
|
|
$this->fileName = $fileName; |
|
137
|
|
|
$this->lineStart = $lineStart; |
|
138
|
|
|
$this->lineEnd = $lineEnd; |
|
139
|
|
|
$this->foundBy = $foundBy; |
|
140
|
|
|
$this->description = $description; |
|
141
|
|
|
$this->severity = $severity; |
|
142
|
|
|
} |
|
143
|
|
|
|
|
144
|
|
|
/** |
|
145
|
|
|
* @return string |
|
146
|
|
|
*/ |
|
147
|
|
|
public function getFileName(): string |
|
148
|
|
|
{ |
|
149
|
|
|
return $this->fileName; |
|
150
|
|
|
} |
|
151
|
|
|
|
|
152
|
|
|
/** |
|
153
|
|
|
* @return int |
|
154
|
|
|
*/ |
|
155
|
|
|
public function getLineStart(): int |
|
156
|
|
|
{ |
|
157
|
|
|
return $this->lineStart; |
|
158
|
|
|
} |
|
159
|
|
|
|
|
160
|
|
|
/** |
|
161
|
|
|
* @return int |
|
162
|
|
|
*/ |
|
163
|
|
|
public function getLineEnd(): int |
|
164
|
|
|
{ |
|
165
|
|
|
return $this->lineEnd; |
|
166
|
|
|
} |
|
167
|
|
|
|
|
168
|
|
|
/** |
|
169
|
|
|
* @return string |
|
170
|
|
|
*/ |
|
171
|
|
|
public function getFoundBy(): string |
|
172
|
|
|
{ |
|
173
|
|
|
return $this->foundBy; |
|
174
|
|
|
} |
|
175
|
|
|
|
|
176
|
|
|
/** |
|
177
|
|
|
* @return string |
|
178
|
|
|
*/ |
|
179
|
|
|
public function getDescription(): string |
|
180
|
|
|
{ |
|
181
|
|
|
return $this->description; |
|
182
|
|
|
} |
|
183
|
|
|
|
|
184
|
|
|
/** |
|
185
|
|
|
* @return string |
|
186
|
|
|
*/ |
|
187
|
|
|
public function getSeverity(): string |
|
188
|
|
|
{ |
|
189
|
|
|
return $this->severity; |
|
190
|
|
|
} |
|
191
|
|
|
} |
|
192
|
|
|
|