3 abstract class PhabricatorObjectStatus
9 protected function __construct($key = null, array $properties = array()) {
11 $this->properties
= $properties;
14 protected function getStatusProperty($key) {
15 if (!array_key_exists($key, $this->properties
)) {
18 'Attempting to access unknown status property ("%s").',
22 return $this->properties
[$key];
25 public function getKey() {
29 public function getIcon() {
30 return $this->getStatusProperty('icon');
33 public function getDisplayName() {
34 return $this->getStatusProperty('name');
37 public function getColor() {
38 return $this->getStatusProperty('color');
41 protected function getStatusSpecification($status) {
42 $map = self
::getStatusSpecifications();
43 if (isset($map[$status])) {
49 'name' => pht('Unknown ("%s")', $status),
50 'icon' => 'fa-question-circle',
52 ) +
$this->newUnknownStatusSpecification($status);
55 protected function getStatusSpecifications() {
56 $map = $this->newStatusSpecifications();
59 foreach ($map as $item) {
60 if (!array_key_exists('key', $item)) {
61 throw new Exception(pht('Status specification has no "key".'));
65 if (isset($result[$key])) {
68 'Multiple status definitions share the same key ("%s").',
72 $result[$key] = $item;
78 abstract protected function newStatusSpecifications();
80 protected function newUnknownStatusSpecification($status) {