Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/differential/constants/DifferentialReviewerStatus.php
12256 views
1
<?php
2
3
final class DifferentialReviewerStatus extends Phobject {
4
5
const STATUS_BLOCKING = 'blocking';
6
const STATUS_ADDED = 'added';
7
const STATUS_ACCEPTED = 'accepted';
8
const STATUS_REJECTED = 'rejected';
9
const STATUS_COMMENTED = 'commented';
10
const STATUS_ACCEPTED_OLDER = 'accepted-older';
11
const STATUS_REJECTED_OLDER = 'rejected-older';
12
const STATUS_RESIGNED = 'resigned';
13
14
/**
15
* Returns the relative strength of a status, used to pick a winner when a
16
* transaction group makes several status changes to a particular reviewer.
17
*
18
* For example, if you accept a revision and leave a comment, the transactions
19
* will attempt to update you to both "commented" and "accepted". We want
20
* "accepted" to win, because it's the stronger of the two.
21
*
22
* @param const Reviewer status constant.
23
* @return int Relative strength (higher is stronger).
24
*/
25
public static function getStatusStrength($constant) {
26
$map = array(
27
self::STATUS_ADDED => 1,
28
29
self::STATUS_COMMENTED => 2,
30
31
self::STATUS_BLOCKING => 3,
32
33
self::STATUS_ACCEPTED_OLDER => 4,
34
self::STATUS_REJECTED_OLDER => 4,
35
36
self::STATUS_ACCEPTED => 5,
37
self::STATUS_REJECTED => 5,
38
self::STATUS_RESIGNED => 5,
39
);
40
41
return idx($map, $constant, 0);
42
}
43
44
}
45
46