[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class ManiphestTaskPriority extends ManiphestConstants { 4 5 /** 6 * Get the priorities and their full descriptions. 7 * 8 * @return map Priorities to descriptions. 9 */ 10 public static function getTaskPriorityMap() { 11 $map = self::getConfig(); 12 foreach ($map as $key => $spec) { 13 $map[$key] = idx($spec, 'name', $key); 14 } 15 return $map; 16 } 17 18 19 /** 20 * Get the priorities and their related short (one-word) descriptions. 21 * 22 * @return map Priorities to short descriptions. 23 */ 24 public static function getShortNameMap() { 25 $map = self::getConfig(); 26 foreach ($map as $key => $spec) { 27 $map[$key] = idx($spec, 'short', idx($spec, 'name', $key)); 28 } 29 return $map; 30 } 31 32 33 /** 34 * Get a map from priority constants to their colors. 35 * 36 * @return map<int, string> Priorities to colors. 37 */ 38 public static function getColorMap() { 39 $map = self::getConfig(); 40 foreach ($map as $key => $spec) { 41 $map[$key] = idx($spec, 'color', 'grey'); 42 } 43 return $map; 44 } 45 46 47 /** 48 * Return the default priority for this instance of Phabricator. 49 * 50 * @return int The value of the default priority constant. 51 */ 52 public static function getDefaultPriority() { 53 return PhabricatorEnv::getEnvConfig('maniphest.default-priority'); 54 } 55 56 57 /** 58 * Retrieve the full name of the priority level provided. 59 * 60 * @param int A priority level. 61 * @return string The priority name if the level is a valid one. 62 */ 63 public static function getTaskPriorityName($priority) { 64 return idx(self::getTaskPriorityMap(), $priority, $priority); 65 } 66 67 /** 68 * Retrieve the color of the priority level given 69 * 70 * @param int A priority level. 71 * @return string The color of the priority if the level is valid, 72 * or black if it is not. 73 */ 74 public static function getTaskPriorityColor($priority) { 75 return idx(self::getColorMap(), $priority, 'black'); 76 } 77 78 79 private static function getConfig() { 80 $config = PhabricatorEnv::getEnvConfig('maniphest.priorities'); 81 krsort($config); 82 return $config; 83 } 84 85 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |