forked from phacility/phabricator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPhabricatorRepositoryPublisherHoldReason.php
78 lines (63 loc) · 2.05 KB
/
PhabricatorRepositoryPublisherHoldReason.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
final class PhabricatorRepositoryPublisherHoldReason
extends Phobject {
private $key;
private $spec;
public static function newForHoldKey($key) {
$spec = self::getSpecForHoldKey($key);
$hold = new self();
$hold->key = $key;
$hold->spec = $spec;
return $hold;
}
private static function getSpecForHoldKey($key) {
$specs = self::getHoldReasonSpecs();
$spec = idx($specs, $key);
if (!$spec) {
$spec = array(
'name' => pht('Unknown Hold ("%s")', $key),
);
}
return $spec;
}
public function getName() {
return $this->getProperty('name');
}
public function getSummary() {
return $this->getProperty('summary');
}
private function getProperty($key, $default = null) {
return idx($this->spec, $key, $default);
}
private static function getHoldReasonSpecs() {
$map = array(
PhabricatorRepositoryPublisher::HOLD_IMPORTING => array(
'name' => pht('Repository Importing'),
'summary' => pht('This repository is still importing.'),
),
PhabricatorRepositoryPublisher::HOLD_PUBLISHING_DISABLED => array(
'name' => pht('Publishing Disabled'),
'summary' => pht('All publishing is disabled for this repository.'),
),
PhabricatorRepositoryPublisher::HOLD_NOT_REACHABLE_FROM_PERMANENT_REF =>
array(
'name' => pht('Not On Permanent Ref'),
'summary' => pht(
'This commit is not an ancestor of any permanent ref.'),
),
PhabricatorRepositoryPublisher::HOLD_REF_NOT_BRANCH => array(
'name' => pht('Not a Branch'),
'summary' => pht('This ref is not a branch.'),
),
PhabricatorRepositoryPublisher::HOLD_UNTRACKED => array(
'name' => pht('Untracked Ref'),
'summary' => pht('This ref is configured as untracked.'),
),
PhabricatorRepositoryPublisher::HOLD_NOT_PERMANENT_REF => array(
'name' => pht('Not a Permanent Ref'),
'summary' => pht('This ref is not configured as a permanent ref.'),
),
);
return $map;
}
}