Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/DiffusionCommitAuditStatus.php
- This file was moved from src/applications/audit/constants/PhabricatorAuditCommitStatusConstants.php.
<?php | <?php | ||||
final class PhabricatorAuditCommitStatusConstants extends Phobject { | final class DiffusionCommitAuditStatus extends Phobject { | ||||
private $key; | private $key; | ||||
private $spec = array(); | private $spec = array(); | ||||
const MODERN_NONE = 'none'; | const NONE = 'none'; | ||||
const MODERN_NEEDS_AUDIT = 'needs-audit'; | const NEEDS_AUDIT = 'needs-audit'; | ||||
const MODERN_CONCERN_RAISED = 'concern-raised'; | const CONCERN_RAISED = 'concern-raised'; | ||||
const MODERN_PARTIALLY_AUDITED = 'partially-audited'; | const PARTIALLY_AUDITED = 'partially-audited'; | ||||
const MODERN_AUDITED = 'audited'; | const AUDITED = 'audited'; | ||||
const MODERN_NEEDS_VERIFICATION = 'needs-verification'; | const NEEDS_VERIFICATION = 'needs-verification'; | ||||
public static function newModernKeys(array $values) { | public static function newModernKeys(array $values) { | ||||
$map = self::getMap(); | $map = self::getMap(); | ||||
$modern = array(); | $modern = array(); | ||||
foreach ($map as $key => $spec) { | foreach ($map as $key => $spec) { | ||||
if (isset($spec['legacy'])) { | if (isset($spec['legacy'])) { | ||||
$modern[$spec['legacy']] = $key; | $modern[$spec['legacy']] = $key; | ||||
Show All 32 Lines | public function getColor() { | ||||
return idx($this->spec, 'color'); | return idx($this->spec, 'color'); | ||||
} | } | ||||
public function getName() { | public function getName() { | ||||
return idx($this->spec, 'name', pht('Unknown ("%s")', $this->key)); | return idx($this->spec, 'name', pht('Unknown ("%s")', $this->key)); | ||||
} | } | ||||
public function isNoAudit() { | public function isNoAudit() { | ||||
return ($this->key == self::MODERN_NONE); | return ($this->key == self::NONE); | ||||
} | } | ||||
public function isNeedsAudit() { | public function isNeedsAudit() { | ||||
return ($this->key == self::MODERN_NEEDS_AUDIT); | return ($this->key == self::NEEDS_AUDIT); | ||||
} | } | ||||
public function isConcernRaised() { | public function isConcernRaised() { | ||||
return ($this->key == self::MODERN_CONCERN_RAISED); | return ($this->key == self::CONCERN_RAISED); | ||||
} | } | ||||
public function isNeedsVerification() { | public function isNeedsVerification() { | ||||
return ($this->key == self::MODERN_NEEDS_VERIFICATION); | return ($this->key == self::NEEDS_VERIFICATION); | ||||
} | } | ||||
public function isPartiallyAudited() { | public function isPartiallyAudited() { | ||||
return ($this->key == self::MODERN_PARTIALLY_AUDITED); | return ($this->key == self::PARTIALLY_AUDITED); | ||||
} | } | ||||
public function isAudited() { | public function isAudited() { | ||||
return ($this->key == self::MODERN_AUDITED); | return ($this->key == self::AUDITED); | ||||
} | } | ||||
public function getIsClosed() { | public function getIsClosed() { | ||||
return idx($this->spec, 'closed'); | return idx($this->spec, 'closed'); | ||||
} | } | ||||
public static function getOpenStatusConstants() { | public static function getOpenStatusConstants() { | ||||
$constants = array(); | $constants = array(); | ||||
Show All 20 Lines | foreach ($map as $key => $spec) { | ||||
} | } | ||||
} | } | ||||
return $results; | return $results; | ||||
} | } | ||||
private static function getMap() { | private static function getMap() { | ||||
return array( | return array( | ||||
self::MODERN_NONE => array( | self::NONE => array( | ||||
'name' => pht('No Audits'), | 'name' => pht('No Audits'), | ||||
'legacy' => 0, | 'legacy' => 0, | ||||
'icon' => 'fa-check', | 'icon' => 'fa-check', | ||||
'color' => 'bluegrey', | 'color' => 'bluegrey', | ||||
'closed' => true, | 'closed' => true, | ||||
), | ), | ||||
self::MODERN_NEEDS_AUDIT => array( | self::NEEDS_AUDIT => array( | ||||
'name' => pht('Audit Required'), | 'name' => pht('Audit Required'), | ||||
'legacy' => 1, | 'legacy' => 1, | ||||
'icon' => 'fa-exclamation-circle', | 'icon' => 'fa-exclamation-circle', | ||||
'color' => 'orange', | 'color' => 'orange', | ||||
'closed' => false, | 'closed' => false, | ||||
), | ), | ||||
self::MODERN_CONCERN_RAISED => array( | self::CONCERN_RAISED => array( | ||||
'name' => pht('Concern Raised'), | 'name' => pht('Concern Raised'), | ||||
'legacy' => 2, | 'legacy' => 2, | ||||
'icon' => 'fa-times-circle', | 'icon' => 'fa-times-circle', | ||||
'color' => 'red', | 'color' => 'red', | ||||
'closed' => false, | 'closed' => false, | ||||
), | ), | ||||
self::MODERN_PARTIALLY_AUDITED => array( | self::PARTIALLY_AUDITED => array( | ||||
'name' => pht('Partially Audited'), | 'name' => pht('Partially Audited'), | ||||
'legacy' => 3, | 'legacy' => 3, | ||||
'icon' => 'fa-check-circle-o', | 'icon' => 'fa-check-circle-o', | ||||
'color' => 'yellow', | 'color' => 'yellow', | ||||
'closed' => false, | 'closed' => false, | ||||
), | ), | ||||
self::MODERN_AUDITED => array( | self::AUDITED => array( | ||||
'name' => pht('Audited'), | 'name' => pht('Audited'), | ||||
'legacy' => 4, | 'legacy' => 4, | ||||
'icon' => 'fa-check-circle', | 'icon' => 'fa-check-circle', | ||||
'color' => 'green', | 'color' => 'green', | ||||
'closed' => true, | 'closed' => true, | ||||
), | ), | ||||
self::MODERN_NEEDS_VERIFICATION => array( | self::NEEDS_VERIFICATION => array( | ||||
'name' => pht('Needs Verification'), | 'name' => pht('Needs Verification'), | ||||
'legacy' => 5, | 'legacy' => 5, | ||||
'icon' => 'fa-refresh', | 'icon' => 'fa-refresh', | ||||
'color' => 'indigo', | 'color' => 'indigo', | ||||
'closed' => false, | 'closed' => false, | ||||
), | ), | ||||
); | ); | ||||
} | } | ||||
} | } |