Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F568395
DifferentialUnitStatus.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
DifferentialUnitStatus.php
View Options
<?php
final
class
DifferentialUnitStatus
extends
Phobject
{
const
UNIT_NONE
=
0
;
const
UNIT_OKAY
=
1
;
const
UNIT_WARN
=
2
;
const
UNIT_FAIL
=
3
;
const
UNIT_SKIP
=
4
;
const
UNIT_AUTO_SKIP
=
6
;
private
$value
;
public
static
function
newStatusFromValue
(
$value
)
{
$status
=
new
self
();
$status
->
value
=
$value
;
return
$status
;
}
public
function
getValue
()
{
return
$this
->
value
;
}
public
function
getName
()
{
$name
=
$this
->
getUnitStatusProperty
(
'name'
);
if
(
$name
===
null
)
{
$name
=
pht
(
'Unknown Unit Status ("%s")'
,
$this
->
getValue
());
}
return
$name
;
}
public
function
getIconIcon
()
{
return
$this
->
getUnitStatusProperty
(
'icon.icon'
);
}
public
function
getIconColor
()
{
return
$this
->
getUnitStatusProperty
(
'icon.color'
);
}
public
static
function
getStatusMap
()
{
$results
=
array
();
foreach
(
self
::
newUnitStatusMap
()
as
$value
=>
$ignored
)
{
$results
[
$value
]
=
self
::
newStatusFromValue
(
$value
);
}
return
$results
;
}
private
function
getUnitStatusProperty
(
$key
,
$default
=
null
)
{
$map
=
self
::
newUnitStatusMap
();
$properties
=
idx
(
$map
,
$this
->
getValue
(),
array
());
return
idx
(
$properties
,
$key
,
$default
);
}
private
static
function
newUnitStatusMap
()
{
return
array
(
self
::
UNIT_NONE
=>
array
(
'name'
=>
pht
(
'No Test Coverage'
),
'icon.icon'
=>
'fa-ban'
,
'icon.color'
=>
'grey'
,
),
self
::
UNIT_OKAY
=>
array
(
'name'
=>
pht
(
'Tests Passed'
),
'icon.icon'
=>
'fa-check'
,
'icon.color'
=>
'green'
,
),
self
::
UNIT_WARN
=>
array
(
'name'
=>
pht
(
'Test Warnings'
),
'icon.icon'
=>
'fa-exclamation-triangle'
,
'icon.color'
=>
'yellow'
,
),
self
::
UNIT_FAIL
=>
array
(
'name'
=>
pht
(
'Test Failures'
),
'icon.icon'
=>
'fa-times'
,
'icon.color'
=>
'red'
,
),
self
::
UNIT_SKIP
=>
array
(
'name'
=>
pht
(
'Tests Skipped'
),
'icon.icon'
=>
'fa-fast-forward'
,
'icon.color'
=>
'blue'
,
),
self
::
UNIT_AUTO_SKIP
=>
array
(
'name'
=>
pht
(
'Tests Not Applicable'
),
'icon.icon'
=>
'fa-code'
,
'icon.color'
=>
'grey'
,
),
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, May 13, 1:25 PM (1 d, 23 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
101002
Default Alt Text
DifferentialUnitStatus.php (2 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment