Changeset View
Changeset View
Standalone View
Standalone View
src/applications/slowvote/constants/SlowvotePollStatus.php
<?php | <?php | ||||
final class SlowvotePollStatus | final class SlowvotePollStatus | ||||
extends Phobject { | extends Phobject { | ||||
const STATUS_OPEN = 0; | const STATUS_OPEN = 'open'; | ||||
const STATUS_CLOSED = 1; | const STATUS_CLOSED = 'closed'; | ||||
private $key; | private $key; | ||||
public static function newStatusObject($key) { | public static function newStatusObject($key) { | ||||
$object = new self(); | $object = new self(); | ||||
$object->key = $key; | $object->key = $key; | ||||
return $object; | return $object; | ||||
} | } | ||||
Show All 26 Lines | final class SlowvotePollStatus | ||||
public function getHeaderTagIcon() { | public function getHeaderTagIcon() { | ||||
return $this->getProperty('header.tag.icon'); | return $this->getProperty('header.tag.icon'); | ||||
} | } | ||||
public function getHeaderTagColor() { | public function getHeaderTagColor() { | ||||
return $this->getProperty('header.tag.color'); | return $this->getProperty('header.tag.color'); | ||||
} | } | ||||
public function getTransactionIcon() { | |||||
return $this->getProperty('transaction.icon'); | |||||
} | |||||
private function getProperty($key, $default = null) { | private function getProperty($key, $default = null) { | ||||
$spec = idx(self::getMap(), $this->getKey(), array()); | $spec = idx(self::getMap(), $this->getKey(), array()); | ||||
return idx($spec, $key, $default); | return idx($spec, $key, $default); | ||||
} | } | ||||
private static function getMap() { | private static function getMap() { | ||||
return array( | return array( | ||||
self::STATUS_OPEN => array( | self::STATUS_OPEN => array( | ||||
'name' => pht('Open'), | 'name' => pht('Open'), | ||||
'header.tag.icon' => 'fa-square-o', | 'header.tag.icon' => 'fa-square-o', | ||||
'header.tag.color' => 'bluegrey', | 'header.tag.color' => 'bluegrey', | ||||
'transaction.icon' => 'fa-pencil', | |||||
), | ), | ||||
self::STATUS_CLOSED => array( | self::STATUS_CLOSED => array( | ||||
'name' => pht('Closed'), | 'name' => pht('Closed'), | ||||
'header.tag.icon' => 'fa-ban', | 'header.tag.icon' => 'fa-ban', | ||||
'header.tag.color' => 'indigo', | 'header.tag.color' => 'indigo', | ||||
'transaction.icon' => 'fa-ban', | |||||
), | ), | ||||
); | ); | ||||
} | } | ||||
} | } |