Path: blob/master/src/applications/owners/constants/PhabricatorOwnersAuditRule.php
12256 views
<?php12final class PhabricatorOwnersAuditRule3extends Phobject {45const AUDITING_NONE = 'none';6const AUDITING_NO_OWNER = 'audit';7const AUDITING_UNREVIEWED = 'unreviewed';8const AUDITING_NO_OWNER_AND_UNREVIEWED = 'uninvolved-unreviewed';9const AUDITING_ALL = 'all';1011private $key;12private $spec;1314public static function newFromState($key) {15$specs = self::newSpecifications();16$spec = idx($specs, $key, array());1718$rule = new self();19$rule->key = $key;20$rule->spec = $spec;2122return $rule;23}2425public function getKey() {26return $this->key;27}2829public function getDisplayName() {30return idx($this->spec, 'name', $this->key);31}3233public function getIconIcon() {34return idx($this->spec, 'icon.icon');35}3637public static function newSelectControlMap() {38$specs = self::newSpecifications();39return ipull($specs, 'name');40}4142public static function getStorageValueFromAPIValue($value) {43$specs = self::newSpecifications();4445$map = array();46foreach ($specs as $key => $spec) {47$deprecated = idx($spec, 'deprecated', array());48if (isset($deprecated[$value])) {49return $key;50}51}5253return $value;54}5556public static function getModernValueMap() {57$specs = self::newSpecifications();5859$map = array();60foreach ($specs as $key => $spec) {61$map[$key] = pht('"%s"', $key);62}6364return $map;65}6667public static function getDeprecatedValueMap() {68$specs = self::newSpecifications();6970$map = array();71foreach ($specs as $key => $spec) {72$deprecated_map = idx($spec, 'deprecated', array());73foreach ($deprecated_map as $deprecated_key => $label) {74$map[$deprecated_key] = $label;75}76}7778return $map;79}8081private static function newSpecifications() {82return array(83self::AUDITING_NONE => array(84'name' => pht('No Auditing'),85'icon.icon' => 'fa-ban',86'deprecated' => array(87'' => pht('"" (empty string)'),88'0' => '"0"',89),90),91self::AUDITING_UNREVIEWED => array(92'name' => pht('Audit Unreviewed Commits'),93'icon.icon' => 'fa-check',94),95self::AUDITING_NO_OWNER => array(96'name' => pht('Audit Commits With No Owner Involvement'),97'icon.icon' => 'fa-check',98'deprecated' => array(99'1' => '"1"',100),101),102self::AUDITING_NO_OWNER_AND_UNREVIEWED => array(103'name' => pht(104'Audit Unreviewed Commits and Commits With No Owner Involvement'),105'icon.icon' => 'fa-check',106),107self::AUDITING_ALL => array(108'name' => pht('Audit All Commits'),109'icon.icon' => 'fa-check',110),111);112}113114115116}117118119