Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/metamta/constants/PhabricatorMailRoutingRule.php
12256 views
1
<?php
2
3
final class PhabricatorMailRoutingRule extends Phobject {
4
5
const ROUTE_AS_NOTIFICATION = 'route.notification';
6
const ROUTE_AS_MAIL = 'route.mail';
7
8
public static function isStrongerThan($rule_u, $rule_v) {
9
$strength_u = self::getRuleStrength($rule_u);
10
$strength_v = self::getRuleStrength($rule_v);
11
12
return ($strength_u > $strength_v);
13
}
14
15
public static function getRuleStrength($const) {
16
$strength = array(
17
self::ROUTE_AS_NOTIFICATION => 1,
18
self::ROUTE_AS_MAIL => 2,
19
);
20
21
return idx($strength, $const, 0);
22
}
23
24
public static function getRuleName($const) {
25
$names = array(
26
self::ROUTE_AS_NOTIFICATION => pht('Route as Notification'),
27
self::ROUTE_AS_MAIL => pht('Route as Mail'),
28
);
29
30
return idx($names, $const, $const);
31
}
32
33
public static function getRuleIcon($const) {
34
$icons = array(
35
self::ROUTE_AS_NOTIFICATION => 'fa-bell',
36
self::ROUTE_AS_MAIL => 'fa-envelope',
37
);
38
39
return idx($icons, $const, 'fa-question-circle');
40
}
41
42
public static function getRuleColor($const) {
43
$colors = array(
44
self::ROUTE_AS_NOTIFICATION => 'grey',
45
self::ROUTE_AS_MAIL => 'grey',
46
);
47
48
return idx($colors, $const, 'yellow');
49
}
50
51
}
52
53