forked from phacility/phabricator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPhabricatorSyntaxStyle.php
44 lines (35 loc) · 1.1 KB
/
PhabricatorSyntaxStyle.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
<?php
abstract class PhabricatorSyntaxStyle extends Phobject {
abstract public function getStyleName();
abstract public function getStyleMap();
final public function getStyleOrder() {
return (string)id(new PhutilSortVector())
->addInt($this->isDefaultStyle() ? 0 : 1)
->addString($this->getStyleName());
}
final public function getSyntaxStyleKey() {
return $this->getPhobjectClassConstant('STYLEKEY');
}
final public function isDefaultStyle() {
return ($this->getSyntaxStyleKey() == 'default');
}
public static function getAllStyles() {
return id(new PhutilClassMapQuery())
->setAncestorClass(__CLASS__)
->setUniqueMethod('getSyntaxStyleKey')
->setSortMethod('getStyleName')
->execute();
}
final public function getRemarkupStyleMap() {
$map = array(
'rbw_r' => 'color: red',
'rbw_o' => 'color: orange',
'rbw_y' => 'color: yellow',
'rbw_g' => 'color: green',
'rbw_b' => 'color: blue',
'rbw_i' => 'color: indigo',
'rbw_v' => 'color: violet',
);
return $map + $this->getStyleMap();
}
}