[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/policy/rule/ -> PhabricatorPolicyRuleLunarPhase.php (source)

   1  <?php
   2  
   3  final class PhabricatorPolicyRuleLunarPhase
   4    extends PhabricatorPolicyRule {
   5  
   6    const PHASE_FULL = 'full';
   7    const PHASE_NEW = 'new';
   8    const PHASE_WAXING = 'waxing';
   9    const PHASE_WANING = 'waning';
  10  
  11    public function getRuleDescription() {
  12      return pht('when the moon');
  13    }
  14  
  15    public function applyRule(PhabricatorUser $viewer, $value) {
  16      $moon = new PhutilLunarPhase(PhabricatorTime::getNow());
  17  
  18      switch ($value) {
  19        case 'full':
  20          return $moon->isFull();
  21        case 'new':
  22          return $moon->isNew();
  23        case 'waxing':
  24          return $moon->isWaxing();
  25        case 'waning':
  26          return $moon->isWaning();
  27      }
  28  
  29      return false;
  30    }
  31  
  32    public function getValueControlType() {
  33      return self::CONTROL_TYPE_SELECT;
  34    }
  35  
  36    public function getValueControlTemplate() {
  37      return array(
  38        'options' => array(
  39          self::PHASE_FULL => pht('is full'),
  40          self::PHASE_NEW => pht('is new'),
  41          self::PHASE_WAXING => pht('is waxing'),
  42          self::PHASE_WANING => pht('is waning'),
  43        ),
  44      );
  45    }
  46  
  47    public function getRuleOrder() {
  48      return 1000;
  49    }
  50  
  51  }


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