@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at upstream/main 103 lines 2.4 kB view raw
1<?php 2 3final class PhabricatorAuthFactorProviderStatus 4 extends Phobject { 5 6 private $key; 7 private $spec = array(); 8 9 const STATUS_ACTIVE = 'active'; 10 const STATUS_DEPRECATED = 'deprecated'; 11 const STATUS_DISABLED = 'disabled'; 12 13 public static function newForStatus($status) { 14 $result = new self(); 15 16 $result->key = $status; 17 $result->spec = self::newSpecification($status); 18 19 return $result; 20 } 21 22 public function getName() { 23 return idx($this->spec, 'name', $this->key); 24 } 25 26 public function getStatusHeaderIcon() { 27 return idx($this->spec, 'header.icon'); 28 } 29 30 public function getStatusHeaderColor() { 31 return idx($this->spec, 'header.color'); 32 } 33 34 public function isActive() { 35 return ($this->key === self::STATUS_ACTIVE); 36 } 37 38 public function getListIcon() { 39 return idx($this->spec, 'list.icon'); 40 } 41 42 public function getListColor() { 43 return idx($this->spec, 'list.color'); 44 } 45 46 public function getFactorIcon() { 47 return idx($this->spec, 'factor.icon'); 48 } 49 50 public function getFactorColor() { 51 return idx($this->spec, 'factor.color'); 52 } 53 54 public function getOrder() { 55 return idx($this->spec, 'order', 0); 56 } 57 58 public static function getMap() { 59 $specs = self::newSpecifications(); 60 return ipull($specs, 'name'); 61 } 62 63 private static function newSpecification($key) { 64 $specs = self::newSpecifications(); 65 return idx($specs, $key, array()); 66 } 67 68 private static function newSpecifications() { 69 return array( 70 self::STATUS_ACTIVE => array( 71 'name' => pht('Active'), 72 'header.icon' => 'fa-check', 73 'header.color' => null, 74 'list.icon' => null, 75 'list.color' => null, 76 'factor.icon' => 'fa-check', 77 'factor.color' => 'green', 78 'order' => 1, 79 ), 80 self::STATUS_DEPRECATED => array( 81 'name' => pht('Deprecated'), 82 'header.icon' => 'fa-ban', 83 'header.color' => 'indigo', 84 'list.icon' => 'fa-ban', 85 'list.color' => 'indigo', 86 'factor.icon' => 'fa-ban', 87 'factor.color' => 'indigo', 88 'order' => 2, 89 ), 90 self::STATUS_DISABLED => array( 91 'name' => pht('Disabled'), 92 'header.icon' => 'fa-times', 93 'header.color' => 'red', 94 'list.icon' => 'fa-times', 95 'list.color' => 'red', 96 'factor.icon' => 'fa-times', 97 'factor.color' => 'grey', 98 'order' => 3, 99 ), 100 ); 101 } 102 103}