Path: blob/master/src/applications/differential/constants/DifferentialRevisionStatus.php
12256 views
<?php12final class DifferentialRevisionStatus extends Phobject {34const NEEDS_REVIEW = 'needs-review';5const NEEDS_REVISION = 'needs-revision';6const CHANGES_PLANNED = 'changes-planned';7const ACCEPTED = 'accepted';8const PUBLISHED = 'published';9const ABANDONED = 'abandoned';10const DRAFT = 'draft';1112private $key;13private $spec = array();1415public function getKey() {16return $this->key;17}1819public function getLegacyKey() {20return idx($this->spec, 'legacy');21}2223public function getIcon() {24return idx($this->spec, 'icon');25}2627public function getIconColor() {28return idx($this->spec, 'color.icon', 'bluegrey');29}3031public function getTagColor() {32return idx($this->spec, 'color.tag', 'bluegrey');33}3435public function getTimelineIcon() {36return idx($this->spec, 'icon.timeline');37}3839public function getTimelineColor() {40return idx($this->spec, 'color.timeline');41}4243public function getANSIColor() {44return idx($this->spec, 'color.ansi');45}4647public function getDisplayName() {48return idx($this->spec, 'name');49}5051public function isClosedStatus() {52return idx($this->spec, 'closed');53}5455public function isAbandoned() {56return ($this->key === self::ABANDONED);57}5859public function isAccepted() {60return ($this->key === self::ACCEPTED);61}6263public function isNeedsReview() {64return ($this->key === self::NEEDS_REVIEW);65}6667public function isNeedsRevision() {68return ($this->key === self::NEEDS_REVISION);69}7071public function isPublished() {72return ($this->key === self::PUBLISHED);73}7475public function isChangePlanned() {76return ($this->key === self::CHANGES_PLANNED);77}7879public function isDraft() {80return ($this->key === self::DRAFT);81}8283public static function newForStatus($status) {84$result = new self();8586$map = self::getMap();87if (isset($map[$status])) {88$result->key = $status;89$result->spec = $map[$status];90}9192return $result;93}9495public static function getAll() {96$result = array();9798foreach (self::getMap() as $key => $spec) {99$result[$key] = self::newForStatus($key);100}101102return $result;103}104105private static function getMap() {106$close_on_accept = PhabricatorEnv::getEnvConfig(107'differential.close-on-accept');108109return array(110self::NEEDS_REVIEW => array(111'name' => pht('Needs Review'),112'legacy' => 0,113'icon' => 'fa-code',114'icon.timeline' => 'fa-undo',115'closed' => false,116'color.icon' => 'grey',117'color.tag' => 'bluegrey',118'color.ansi' => 'magenta',119'color.timeline' => 'orange',120),121self::NEEDS_REVISION => array(122'name' => pht('Needs Revision'),123'legacy' => 1,124'icon' => 'fa-refresh',125'icon.timeline' => 'fa-times',126'closed' => false,127'color.icon' => 'red',128'color.tag' => 'red',129'color.ansi' => 'red',130'color.timeline' => 'red',131),132self::CHANGES_PLANNED => array(133'name' => pht('Changes Planned'),134'legacy' => 5,135'icon' => 'fa-headphones',136'closed' => false,137'color.icon' => 'red',138'color.tag' => 'red',139'color.ansi' => 'red',140),141self::ACCEPTED => array(142'name' => pht('Accepted'),143'legacy' => 2,144'icon' => 'fa-check',145'icon.timeline' => 'fa-check',146'closed' => $close_on_accept,147'color.icon' => 'green',148'color.tag' => 'green',149'color.ansi' => 'green',150'color.timeline' => 'green',151),152self::PUBLISHED => array(153'name' => pht('Closed'),154'legacy' => 3,155'icon' => 'fa-check-square-o',156'closed' => true,157'color.icon' => 'black',158'color.tag' => 'indigo',159'color.ansi' => 'cyan',160),161self::ABANDONED => array(162'name' => pht('Abandoned'),163'legacy' => 4,164'icon' => 'fa-plane',165'closed' => true,166'color.icon' => 'black',167'color.tag' => 'indigo',168'color.ansi' => null,169),170self::DRAFT => array(171'name' => pht('Draft'),172// For legacy clients, treat this as though it is "Needs Review".173'legacy' => 0,174'icon' => 'fa-spinner',175'closed' => false,176'color.icon' => 'pink',177'color.tag' => 'pink',178'color.ansi' => null,179),180);181}182183}184185186