Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F2751275
LintError.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
LintError.php
View Options
<?php
/**
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*
* @file
*/
namespace
MediaWiki\Linter
;
use
MediaWiki\Json\FormatJson
;
/**
* Model to represent a LintError
*/
class
LintError
{
/**
* @var string
*/
public
$category
;
/**
* @var int[] [ start, end ]
*/
public
$location
;
/**
* @var int
*/
public
$lintId
;
/**
* @var array
*/
public
$params
;
/**
* @var array|null
*/
public
$templateInfo
;
/**
* @var string|null
*/
public
$tagInfo
;
/**
* Optional hint for the linter category ID.
* Passed through from Parsoid when a new category has been added
* that isn't known to PHP yet.
* @var int|null
*/
public
$catId
;
/**
* @param string $category
* @param int[] $location [ start, end ]
* @param string|array $params JSON string or already decoded array
* @param int|null $catId Optional category ID hint
* @param int $lintId Optional linter_id
*/
public
function
__construct
(
$category
,
$location
,
$params
,
$catId
=
null
,
$lintId
=
0
)
{
$this
->
category
=
$category
;
$this
->
catId
=
$catId
;
if
(
is_string
(
$params
)
)
{
$params
=
FormatJson
::
decode
(
$params
,
true
);
}
$this
->
params
=
$params
;
$this
->
lintId
=
$lintId
;
$this
->
location
=
$location
;
// Convenient accessors for all errors
$this
->
templateInfo
=
$params
[
'templateInfo'
]
??
null
;
$this
->
tagInfo
=
$params
[
'name'
]
??
null
;
}
/**
* Unique id to identify this error, for internal
* purposes
*
* @return string
*/
public
function
id
()
{
return
$this
->
category
.
",{$this->location[0]},{$this->location[1]},"
.
FormatJson
::
encode
(
$this
->
params
);
}
/**
* Get the params that are extra for this error,
* not part of the default set
*
* @return array
*/
public
function
getExtraParams
()
{
$params
=
$this
->
params
;
unset
(
$params
[
'templateInfo'
]
);
return
$params
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Jul 3, 18:13 (1 d, 9 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
8e/be/437e4b3ed8d6d26161a6c7a32061
Default Alt Text
LintError.php (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment