Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / src / applications / audit / constants / PhabricatorAuditRequestStatus.php
blobea0c496df051ef07a51a95108a1dc6029134b7ce
1 <?php
3 final class PhabricatorAuditRequestStatus extends Phobject {
5 const AUDIT_REQUIRED = 'audit-required';
6 const CONCERNED = 'concerned';
7 const ACCEPTED = 'accepted';
8 const AUDIT_REQUESTED = 'requested';
9 const RESIGNED = 'resigned';
11 private $key;
13 public static function newForStatus($status) {
14 $result = new self();
15 $result->key = $status;
16 return $result;
19 public function getIconIcon() {
20 return $this->getMapProperty('icon');
23 public function getIconColor() {
24 return $this->getMapProperty('icon.color');
27 public function getStatusName() {
28 $name = $this->getMapProperty('name');
29 if ($name !== null) {
30 return $name;
33 return pht('Unknown Audit Request Status ("%s")', $this->key);
36 public function getStatusValue() {
37 return $this->key;
40 public function getStatusValueForConduit() {
41 return $this->getMapProperty('value.conduit');
44 public function isResigned() {
45 return ($this->key === self::RESIGNED);
48 private function getMapProperty($key, $default = null) {
49 $map = self::newStatusMap();
50 $spec = idx($map, $this->key, array());
51 return idx($spec, $key, $default);
54 private static function newStatusMap() {
55 return array(
56 self::AUDIT_REQUIRED => array(
57 'name' => pht('Audit Required'),
58 'icon' => 'fa-exclamation-circle',
59 'icon.color' => 'orange',
60 'value.conduit' => 'audit-required',
62 self::AUDIT_REQUESTED => array(
63 'name' => pht('Audit Requested'),
64 'icon' => 'fa-exclamation-circle',
65 'icon.color' => 'orange',
66 'value.conduit' => 'audit-requested',
68 self::CONCERNED => array(
69 'name' => pht('Concern Raised'),
70 'icon' => 'fa-times-circle',
71 'icon.color' => 'red',
72 'value.conduit' => 'concern-raised',
74 self::ACCEPTED => array(
75 'name' => pht('Accepted'),
76 'icon' => 'fa-check-circle',
77 'icon.color' => 'green',
78 'value.conduit' => 'accepted',
80 self::RESIGNED => array(
81 'name' => pht('Resigned'),
82 'icon' => 'fa-times',
83 'icon.color' => 'grey',
84 'value.conduit' => 'resigned',