[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/differential/constants/ -> DifferentialReviewerStatus.php (source)

   1  <?php
   2  
   3  final class DifferentialReviewerStatus {
   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  
  13    /**
  14     * Returns the relative strength of a status, used to pick a winner when a
  15     * transaction group makes several status changes to a particular reviewer.
  16     *
  17     * For example, if you accept a revision and leave a comment, the transactions
  18     * will attempt to update you to both "commented" and "accepted". We want
  19     * "accepted" to win, because it's the stronger of the two.
  20     *
  21     * @param   const Reviewer status constant.
  22     * @return  int   Relative strength (higher is stronger).
  23     */
  24    public static function getStatusStrength($constant) {
  25      $map = array(
  26        self::STATUS_ADDED      => 1,
  27  
  28        self::STATUS_COMMENTED  => 2,
  29  
  30        self::STATUS_BLOCKING   => 3,
  31  
  32        self::STATUS_ACCEPTED_OLDER   => 4,
  33        self::STATUS_REJECTED_OLDER   => 4,
  34  
  35        self::STATUS_ACCEPTED   => 5,
  36        self::STATUS_REJECTED   => 5,
  37      );
  38  
  39      return idx($map, $constant, 0);
  40    }
  41  
  42  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1