Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/metamta/stamp/PhabricatorMailStamp.php
12256 views
1
<?php
2
3
abstract class PhabricatorMailStamp
4
extends Phobject {
5
6
private $key;
7
private $value;
8
private $label;
9
private $viewer;
10
11
final public function getStampType() {
12
return $this->getPhobjectClassConstant('STAMPTYPE');
13
}
14
15
final public function setKey($key) {
16
$this->key = $key;
17
return $this;
18
}
19
20
final public function getKey() {
21
return $this->key;
22
}
23
24
final protected function setRawValue($value) {
25
$this->value = $value;
26
return $this;
27
}
28
29
final protected function getRawValue() {
30
return $this->value;
31
}
32
33
final public function setViewer(PhabricatorUser $viewer) {
34
$this->viewer = $viewer;
35
return $this;
36
}
37
38
final public function getViewer() {
39
return $this->viewer;
40
}
41
42
final public function setLabel($label) {
43
$this->label = $label;
44
return $this;
45
}
46
47
final public function getLabel() {
48
return $this->label;
49
}
50
51
public function setValue($value) {
52
return $this->setRawValue($value);
53
}
54
55
final public function toDictionary() {
56
return array(
57
'type' => $this->getStampType(),
58
'key' => $this->getKey(),
59
'value' => $this->getValueForDictionary(),
60
);
61
}
62
63
final public static function getAllStamps() {
64
return id(new PhutilClassMapQuery())
65
->setAncestorClass(__CLASS__)
66
->setUniqueMethod('getStampType')
67
->execute();
68
}
69
70
protected function getValueForDictionary() {
71
return $this->getRawValue();
72
}
73
74
public function setValueFromDictionary($value) {
75
return $this->setRawValue($value);
76
}
77
78
public function getValueForRendering() {
79
return $this->getRawValue();
80
}
81
82
abstract public function renderStamps($value);
83
84
final protected function renderStamp($key, $value = null) {
85
return $key.'('.$value.')';
86
}
87
88
}
89
90