Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/maniphest/herald/HeraldManiphestTaskAdapter.php
12256 views
1
<?php
2
3
final class HeraldManiphestTaskAdapter extends HeraldAdapter {
4
5
private $task;
6
7
protected function newObject() {
8
return new ManiphestTask();
9
}
10
11
public function getAdapterApplicationClass() {
12
return 'PhabricatorManiphestApplication';
13
}
14
15
public function getAdapterContentDescription() {
16
return pht('React to tasks being created or updated.');
17
}
18
19
public function isTestAdapterForObject($object) {
20
return ($object instanceof ManiphestTask);
21
}
22
23
public function getAdapterTestDescription() {
24
return pht(
25
'Test rules which run when a task is created or updated.');
26
}
27
28
protected function initializeNewAdapter() {
29
$this->task = $this->newObject();
30
}
31
32
public function supportsApplicationEmail() {
33
return true;
34
}
35
36
public function supportsRuleType($rule_type) {
37
switch ($rule_type) {
38
case HeraldRuleTypeConfig::RULE_TYPE_GLOBAL:
39
case HeraldRuleTypeConfig::RULE_TYPE_PERSONAL:
40
return true;
41
case HeraldRuleTypeConfig::RULE_TYPE_OBJECT:
42
default:
43
return false;
44
}
45
}
46
47
public function setTask(ManiphestTask $task) {
48
$this->task = $task;
49
return $this;
50
}
51
52
public function getTask() {
53
return $this->task;
54
}
55
56
public function setObject($object) {
57
$this->task = $object;
58
return $this;
59
}
60
61
public function getObject() {
62
return $this->task;
63
}
64
65
public function getAdapterContentName() {
66
return pht('Maniphest Tasks');
67
}
68
69
public function getHeraldName() {
70
return 'T'.$this->getTask()->getID();
71
}
72
73
}
74
75