Remove all "FileHasObject" edge reads and writes
[phabricator.git] / src / applications / auth / constants / PhabricatorAuthFactorProviderStatus.php
blob61d4a12576d3e02049074113882cc2cecd2c5b8a
1 <?php
3 final class PhabricatorAuthFactorProviderStatus
4 extends Phobject {
6 private $key;
7 private $spec = array();
9 const STATUS_ACTIVE = 'active';
10 const STATUS_DEPRECATED = 'deprecated';
11 const STATUS_DISABLED = 'disabled';
13 public static function newForStatus($status) {
14 $result = new self();
16 $result->key = $status;
17 $result->spec = self::newSpecification($status);
19 return $result;
22 public function getName() {
23 return idx($this->spec, 'name', $this->key);
26 public function getStatusHeaderIcon() {
27 return idx($this->spec, 'header.icon');
30 public function getStatusHeaderColor() {
31 return idx($this->spec, 'header.color');
34 public function isActive() {
35 return ($this->key === self::STATUS_ACTIVE);
38 public function getListIcon() {
39 return idx($this->spec, 'list.icon');
42 public function getListColor() {
43 return idx($this->spec, 'list.color');
46 public function getFactorIcon() {
47 return idx($this->spec, 'factor.icon');
50 public function getFactorColor() {
51 return idx($this->spec, 'factor.color');
54 public function getOrder() {
55 return idx($this->spec, 'order', 0);
58 public static function getMap() {
59 $specs = self::newSpecifications();
60 return ipull($specs, 'name');
63 private static function newSpecification($key) {
64 $specs = self::newSpecifications();
65 return idx($specs, $key, array());
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,
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,
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,