Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F3282155
ArcanistLintSeverity.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
1 KB
Referenced Files
None
Subscribers
None
ArcanistLintSeverity.php
View Options
<?php
/**
* Describes the severity of an @{class:ArcanistLintMessage}.
*/
final
class
ArcanistLintSeverity
extends
Phobject
{
const
SEVERITY_ADVICE
=
'advice'
;
const
SEVERITY_AUTOFIX
=
'autofix'
;
const
SEVERITY_WARNING
=
'warning'
;
const
SEVERITY_ERROR
=
'error'
;
const
SEVERITY_DISABLED
=
'disabled'
;
public
static
function
getLintSeverities
(
)
{
return
array
(
self
::
SEVERITY_ADVICE
=>
pht
(
'Advice'
)
,
self
::
SEVERITY_AUTOFIX
=>
pht
(
'Auto-Fix'
)
,
self
::
SEVERITY_WARNING
=>
pht
(
'Warning'
)
,
self
::
SEVERITY_ERROR
=>
pht
(
'Error'
)
,
self
::
SEVERITY_DISABLED
=>
pht
(
'Disabled'
)
,
)
;
}
public
static
function
getStringForSeverity
(
$severity_code
)
{
$map
=
self
::
getLintSeverities
(
)
;
if
(
!
array_key_exists
(
$severity_code
,
$map
)
)
{
throw
new
Exception
(
pht
(
"Unknown lint severity '%s'!"
,
$severity_code
)
)
;
}
return
$map
[
$severity_code
]
;
}
public
static
function
isAtLeastAsSevere
(
$message_sev
,
$level
)
{
static
$map
=
array
(
self
::
SEVERITY_DISABLED
=>
10
,
self
::
SEVERITY_ADVICE
=>
20
,
self
::
SEVERITY_AUTOFIX
=>
25
,
self
::
SEVERITY_WARNING
=>
30
,
self
::
SEVERITY_ERROR
=>
40
,
)
;
if
(
empty
(
$map
[
$message_sev
]
)
)
{
return
true
;
}
return
$map
[
$message_sev
]
>=
idx
(
$map
,
$level
,
0
)
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, Mar 24, 05:42 (4 d, 4 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1112941
Default Alt Text
ArcanistLintSeverity.php (1 KB)
Attached To
Mode
rARC Arcanist
Attached
Detach File
Event Timeline
Log In to Comment