Differential D19651 Diff 46970 src/applications/audit/constants/PhabricatorAuditCommitStatusConstants.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/audit/constants/PhabricatorAuditCommitStatusConstants.php
Show First 20 Lines • Show All 87 Lines • ▼ Show 20 Lines | final class PhabricatorAuditCommitStatusConstants extends Phobject { | ||||
public function isAudited() { | public function isAudited() { | ||||
return ($this->key == self::MODERN_AUDITED); | return ($this->key == self::MODERN_AUDITED); | ||||
} | } | ||||
public function getIsClosed() { | public function getIsClosed() { | ||||
return idx($this->spec, 'closed'); | return idx($this->spec, 'closed'); | ||||
} | } | ||||
public static function getStatusNameMap() { | |||||
$map = self::getMap(); | |||||
return ipull($map, 'name', 'legacy'); | |||||
} | |||||
public static function getStatusName($code) { | |||||
return idx(self::getStatusNameMap(), $code, pht('Unknown')); | |||||
} | |||||
public static function getOpenStatusConstants() { | public static function getOpenStatusConstants() { | ||||
$constants = array(); | $constants = array(); | ||||
foreach (self::getMap() as $map) { | foreach (self::getMap() as $map) { | ||||
if (!$map['closed']) { | if (!$map['closed']) { | ||||
$constants[] = $map['legacy']; | $constants[] = $map['legacy']; | ||||
} | } | ||||
} | } | ||||
return $constants; | return $constants; | ||||
} | } | ||||
public static function getStatusColor($code) { | public static function newOptions() { | ||||
$map = self::getMap(); | $map = self::getMap(); | ||||
$map = ipull($map, 'color', 'legacy'); | return ipull($map, 'name'); | ||||
return idx($map, $code); | |||||
} | } | ||||
public static function getStatusIcon($code) { | public static function newDeprecatedOptions() { | ||||
$map = self::getMap(); | $map = self::getMap(); | ||||
$map = ipull($map, 'icon', 'legacy'); | |||||
return idx($map, $code); | $results = array(); | ||||
foreach ($map as $key => $spec) { | |||||
if (isset($spec['legacy'])) { | |||||
$results[$spec['legacy']] = $key; | |||||
} | |||||
} | |||||
return $results; | |||||
} | } | ||||
epriestley: No more callers for this stuff. | |||||
private static function getMap() { | private static function getMap() { | ||||
return array( | return array( | ||||
self::MODERN_NONE => array( | self::MODERN_NONE => array( | ||||
'name' => pht('No Audits'), | 'name' => pht('No Audits'), | ||||
'legacy' => self::NONE, | 'legacy' => self::NONE, | ||||
'icon' => 'fa-check', | 'icon' => 'fa-check', | ||||
'color' => 'bluegrey', | 'color' => 'bluegrey', | ||||
Show All 40 Lines |
No more callers for this stuff.