Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96206522
PhabricatorBadgesQuality.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Dec 23, 18:33
Size
1 KB
Mime Type
text/x-php
Expires
Wed, Dec 25, 18:33 (1 d, 17 h)
Engine
blob
Format
Raw Data
Handle
23143335
Attached To
rPH Phabricator
PhabricatorBadgesQuality.php
View Options
<?php
final
class
PhabricatorBadgesQuality
extends
Phobject
{
const
POOR
=
140
;
const
COMMON
=
120
;
const
UNCOMMON
=
100
;
const
RARE
=
80
;
const
EPIC
=
60
;
const
LEGENDARY
=
40
;
const
HEIRLOOM
=
20
;
const
DEFAULT_QUALITY
=
140
;
public
static
function
getQualityName
(
$quality
)
{
$map
=
self
::
getQualityDictionary
(
$quality
);
$default
=
pht
(
'Unknown Quality ("%s")'
,
$quality
);
return
idx
(
$map
,
'name'
,
$default
);
}
public
static
function
getQualityColor
(
$quality
)
{
$map
=
self
::
getQualityDictionary
(
$quality
);
$default
=
'grey'
;
return
idx
(
$map
,
'color'
,
$default
);
}
private
static
function
getQualityDictionary
(
$quality
)
{
$map
=
self
::
getQualityMap
();
$default
=
array
();
return
idx
(
$map
,
$quality
,
$default
);
}
public
static
function
getQualityMap
()
{
return
array
(
self
::
POOR
=>
array
(
'rarity'
=>
140
,
'name'
=>
pht
(
'Poor'
),
'color'
=>
'grey'
,
),
self
::
COMMON
=>
array
(
'rarity'
=>
120
,
'name'
=>
pht
(
'Common'
),
'color'
=>
'white'
,
),
self
::
UNCOMMON
=>
array
(
'rarity'
=>
100
,
'name'
=>
pht
(
'Uncommon'
),
'color'
=>
'green'
,
),
self
::
RARE
=>
array
(
'rarity'
=>
80
,
'name'
=>
pht
(
'Rare'
),
'color'
=>
'blue'
,
),
self
::
EPIC
=>
array
(
'rarity'
=>
60
,
'name'
=>
pht
(
'Epic'
),
'color'
=>
'indigo'
,
),
self
::
LEGENDARY
=>
array
(
'rarity'
=>
40
,
'name'
=>
pht
(
'Legendary'
),
'color'
=>
'orange'
,
),
self
::
HEIRLOOM
=>
array
(
'rarity'
=>
20
,
'name'
=>
pht
(
'Heirloom'
),
'color'
=>
'yellow'
,
),
);
}
public
static
function
getDropdownQualityMap
()
{
$map
=
self
::
getQualityMap
();
return
ipull
(
$map
,
'name'
);
}
}
Event Timeline
Log In to Comment