Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / src / applications / repository / query / PhabricatorRepositoryPublisherHoldReason.php
blobbdf776c83aa45d922996ef4d36fff082a03b1788
1 <?php
3 final class PhabricatorRepositoryPublisherHoldReason
4 extends Phobject {
6 private $key;
7 private $spec;
9 public static function newForHoldKey($key) {
10 $spec = self::getSpecForHoldKey($key);
12 $hold = new self();
13 $hold->key = $key;
14 $hold->spec = $spec;
16 return $hold;
19 private static function getSpecForHoldKey($key) {
20 $specs = self::getHoldReasonSpecs();
22 $spec = idx($specs, $key);
24 if (!$spec) {
25 $spec = array(
26 'name' => pht('Unknown Hold ("%s")', $key),
30 return $spec;
33 public function getName() {
34 return $this->getProperty('name');
37 public function getSummary() {
38 return $this->getProperty('summary');
41 private function getProperty($key, $default = null) {
42 return idx($this->spec, $key, $default);
45 private static function getHoldReasonSpecs() {
46 $map = array(
47 PhabricatorRepositoryPublisher::HOLD_IMPORTING => array(
48 'name' => pht('Repository Importing'),
49 'summary' => pht('This repository is still importing.'),
51 PhabricatorRepositoryPublisher::HOLD_PUBLISHING_DISABLED => array(
52 'name' => pht('Publishing Disabled'),
53 'summary' => pht('All publishing is disabled for this repository.'),
55 PhabricatorRepositoryPublisher::HOLD_NOT_REACHABLE_FROM_PERMANENT_REF =>
56 array(
57 'name' => pht('Not On Permanent Ref'),
58 'summary' => pht(
59 'This commit is not an ancestor of any permanent ref.'),
61 PhabricatorRepositoryPublisher::HOLD_REF_NOT_BRANCH => array(
62 'name' => pht('Not a Branch'),
63 'summary' => pht('This ref is not a branch.'),
65 PhabricatorRepositoryPublisher::HOLD_UNTRACKED => array(
66 'name' => pht('Untracked Ref'),
67 'summary' => pht('This ref is configured as untracked.'),
69 PhabricatorRepositoryPublisher::HOLD_NOT_PERMANENT_REF => array(
70 'name' => pht('Not a Permanent Ref'),
71 'summary' => pht('This ref is not configured as a permanent ref.'),
75 return $map;