Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / src / applications / badges / constants / PhabricatorBadgesQuality.php
blob8ab7f3b7d96c36f4a32c1b430731ed408d2cf7dc
1 <?php
3 final class PhabricatorBadgesQuality
4 extends Phobject {
6 const POOR = 140;
7 const COMMON = 120;
8 const UNCOMMON = 100;
9 const RARE = 80;
10 const EPIC = 60;
11 const LEGENDARY = 40;
12 const HEIRLOOM = 20;
14 const DEFAULT_QUALITY = 140;
16 public static function getQualityName($quality) {
17 $map = self::getQualityDictionary($quality);
18 $default = pht('Unknown Quality ("%s")', $quality);
19 return idx($map, 'name', $default);
22 public static function getQualityColor($quality) {
23 $map = self::getQualityDictionary($quality);
24 $default = 'grey';
25 return idx($map, 'color', $default);
28 private static function getQualityDictionary($quality) {
29 $map = self::getQualityMap();
30 $default = array();
31 return idx($map, $quality, $default);
34 public static function getQualityMap() {
35 return array(
36 self::POOR => array(
37 'rarity' => 140,
38 'name' => pht('Poor'),
39 'color' => 'grey',
41 self::COMMON => array(
42 'rarity' => 120,
43 'name' => pht('Common'),
44 'color' => 'white',
46 self::UNCOMMON => array(
47 'rarity' => 100,
48 'name' => pht('Uncommon'),
49 'color' => 'green',
51 self::RARE => array(
52 'rarity' => 80,
53 'name' => pht('Rare'),
54 'color' => 'blue',
56 self::EPIC => array(
57 'rarity' => 60,
58 'name' => pht('Epic'),
59 'color' => 'indigo',
61 self::LEGENDARY => array(
62 'rarity' => 40,
63 'name' => pht('Legendary'),
64 'color' => 'orange',
66 self::HEIRLOOM => array(
67 'rarity' => 20,
68 'name' => pht('Heirloom'),
69 'color' => 'yellow',
74 public static function getDropdownQualityMap() {
75 $map = self::getQualityMap();
76 return ipull($map, 'name');