Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F465068
HarbormasterLintPropertyView.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
HarbormasterLintPropertyView.php
View Options
<?php
final
class
HarbormasterLintPropertyView
extends
AphrontView
{
private
$pathURIMap
=
array
();
private
$lintMessages
=
array
();
private
$limit
;
public
function
setPathURIMap
(
array
$map
)
{
$this
->
pathURIMap
=
$map
;
return
$this
;
}
public
function
setLintMessages
(
array
$messages
)
{
assert_instances_of
(
$messages
,
'HarbormasterBuildLintMessage'
);
$this
->
lintMessages
=
$messages
;
return
$this
;
}
public
function
setLimit
(
$limit
)
{
$this
->
limit
=
$limit
;
return
$this
;
}
public
function
render
()
{
$messages
=
$this
->
lintMessages
;
$messages
=
msort
(
$messages
,
'getSortKey'
);
if
(
$this
->
limit
)
{
$messages
=
array_slice
(
$messages
,
0
,
$this
->
limit
);
}
$rows
=
array
();
foreach
(
$messages
as
$message
)
{
$path
=
$message
->
getPath
();
$line
=
$message
->
getLine
();
$href
=
null
;
if
(
strlen
(
idx
(
$this
->
pathURIMap
,
$path
)))
{
$href
=
$this
->
pathURIMap
[
$path
].
max
(
$line
,
1
);
}
$severity
=
$this
->
renderSeverity
(
$message
->
getSeverity
());
$location
=
$path
.
':'
.
$line
;
if
(
strlen
(
$href
))
{
$location
=
phutil_tag
(
'a'
,
array
(
'href'
=>
$href
,
),
$location
);
}
$rows
[]
=
array
(
$severity
,
$location
,
$message
->
getCode
(),
$message
->
getName
(),
);
}
$table
=
id
(
new
AphrontTableView
(
$rows
))
->
setHeaders
(
array
(
pht
(
'Severity'
),
pht
(
'Location'
),
pht
(
'Code'
),
pht
(
'Message'
),
))
->
setColumnClasses
(
array
(
null
,
'pri'
,
null
,
'wide'
,
));
return
$table
;
}
private
function
renderSeverity
(
$severity
)
{
$names
=
ArcanistLintSeverity
::
getLintSeverities
();
$name
=
idx
(
$names
,
$severity
,
$severity
);
// TODO: Add some color here?
return
$name
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Mon, May 5, 10:19 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
74418
Default Alt Text
HarbormasterLintPropertyView.php (1 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment