Differential D21844 Diff 52063 src/applications/slowvote/constants/SlowvotePollResponseVisibility.php
Changeset View
Changeset View
Standalone View
Standalone View
src/applications/slowvote/constants/SlowvotePollResponseVisibility.php
<?php | <?php | ||||
final class SlowvotePollResponseVisibility | final class SlowvotePollResponseVisibility | ||||
extends Phobject { | extends Phobject { | ||||
const RESPONSES_VISIBLE = 0; | const RESPONSES_VISIBLE = 'visible'; | ||||
const RESPONSES_VOTERS = 1; | const RESPONSES_VOTERS = 'voters'; | ||||
const RESPONSES_OWNER = 2; | const RESPONSES_OWNER = 'owner'; | ||||
private $key; | private $key; | ||||
public static function newResponseVisibilityObject($key) { | public static function newResponseVisibilityObject($key) { | ||||
$object = new self(); | $object = new self(); | ||||
$object->key = $key; | $object->key = $key; | ||||
return $object; | return $object; | ||||
} | } | ||||
Show All 29 Lines | public function getNameForEdit() { | ||||
if ($name === null) { | if ($name === null) { | ||||
$name = pht('Unknown ("%s")', $this->getKey()); | $name = pht('Unknown ("%s")', $this->getKey()); | ||||
} | } | ||||
return $name; | return $name; | ||||
} | } | ||||
private function getProperty($key, $default = null) { | private function getProperty($key, $default = null) { | ||||
$spec = idx(self::getMap(), $this->getKey()); | $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::RESPONSES_VISIBLE => array( | self::RESPONSES_VISIBLE => array( | ||||
'name' => pht('Always Visible'), | 'name' => pht('Always Visible'), | ||||
'name.edit' => pht('Anyone can see the responses'), | 'name.edit' => pht('Anyone can see the responses'), | ||||
Show All 13 Lines |