3 final class PhabricatorOwnersAuditRule
6 const AUDITING_NONE
= 'none';
7 const AUDITING_NO_OWNER
= 'audit';
8 const AUDITING_UNREVIEWED
= 'unreviewed';
9 const AUDITING_NO_OWNER_AND_UNREVIEWED
= 'uninvolved-unreviewed';
10 const AUDITING_ALL
= 'all';
15 public static function newFromState($key) {
16 $specs = self
::newSpecifications();
17 $spec = idx($specs, $key, array());
26 public function getKey() {
30 public function getDisplayName() {
31 return idx($this->spec
, 'name', $this->key
);
34 public function getIconIcon() {
35 return idx($this->spec
, 'icon.icon');
38 public static function newSelectControlMap() {
39 $specs = self
::newSpecifications();
40 return ipull($specs, 'name');
43 public static function getStorageValueFromAPIValue($value) {
44 $specs = self
::newSpecifications();
47 foreach ($specs as $key => $spec) {
48 $deprecated = idx($spec, 'deprecated', array());
49 if (isset($deprecated[$value])) {
57 public static function getModernValueMap() {
58 $specs = self
::newSpecifications();
61 foreach ($specs as $key => $spec) {
62 $map[$key] = pht('"%s"', $key);
68 public static function getDeprecatedValueMap() {
69 $specs = self
::newSpecifications();
72 foreach ($specs as $key => $spec) {
73 $deprecated_map = idx($spec, 'deprecated', array());
74 foreach ($deprecated_map as $deprecated_key => $label) {
75 $map[$deprecated_key] = $label;
82 private static function newSpecifications() {
84 self
::AUDITING_NONE
=> array(
85 'name' => pht('No Auditing'),
86 'icon.icon' => 'fa-ban',
87 'deprecated' => array(
88 '' => pht('"" (empty string)'),
92 self
::AUDITING_UNREVIEWED
=> array(
93 'name' => pht('Audit Unreviewed Commits'),
94 'icon.icon' => 'fa-check',
96 self
::AUDITING_NO_OWNER
=> array(
97 'name' => pht('Audit Commits With No Owner Involvement'),
98 'icon.icon' => 'fa-check',
99 'deprecated' => array(
103 self
::AUDITING_NO_OWNER_AND_UNREVIEWED
=> array(
105 'Audit Unreviewed Commits and Commits With No Owner Involvement'),
106 'icon.icon' => 'fa-check',
108 self
::AUDITING_ALL
=> array(
109 'name' => pht('Audit All Commits'),
110 'icon.icon' => 'fa-check',