[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/harbormaster/storage/configuration/ -> HarbormasterBuildPlan.php (source)

   1  <?php
   2  
   3  final class HarbormasterBuildPlan extends HarbormasterDAO
   4    implements
   5      PhabricatorPolicyInterface,
   6      PhabricatorSubscribableInterface {
   7  
   8    protected $name;
   9    protected $planStatus;
  10  
  11    const STATUS_ACTIVE   = 'active';
  12    const STATUS_DISABLED = 'disabled';
  13  
  14    private $buildSteps = self::ATTACHABLE;
  15  
  16    public static function initializeNewBuildPlan(PhabricatorUser $actor) {
  17      return id(new HarbormasterBuildPlan())
  18        ->setPlanStatus(self::STATUS_ACTIVE);
  19    }
  20  
  21    public function getConfiguration() {
  22      return array(
  23        self::CONFIG_AUX_PHID => true,
  24        self::CONFIG_COLUMN_SCHEMA => array(
  25          'name' => 'text255',
  26          'planStatus' => 'text32',
  27        ),
  28        self::CONFIG_KEY_SCHEMA => array(
  29          'key_status' => array(
  30            'columns' => array('planStatus'),
  31          ),
  32        ),
  33      ) + parent::getConfiguration();
  34    }
  35  
  36    public function generatePHID() {
  37      return PhabricatorPHID::generateNewPHID(
  38        HarbormasterBuildPlanPHIDType::TYPECONST);
  39    }
  40  
  41    public function attachBuildSteps(array $steps) {
  42      assert_instances_of($steps, 'HarbormasterBuildStep');
  43      $this->buildSteps = $steps;
  44      return $this;
  45    }
  46  
  47    public function getBuildSteps() {
  48      return $this->assertAttached($this->buildSteps);
  49    }
  50  
  51    public function isDisabled() {
  52      return ($this->getPlanStatus() == self::STATUS_DISABLED);
  53    }
  54  
  55  
  56  /* -(  PhabricatorSubscribableInterface  )----------------------------------- */
  57  
  58  
  59    public function isAutomaticallySubscribed($phid) {
  60      return false;
  61    }
  62  
  63    public function shouldShowSubscribersProperty() {
  64      return true;
  65    }
  66  
  67    public function shouldAllowSubscription($phid) {
  68      return true;
  69    }
  70  
  71  
  72  /* -(  PhabricatorPolicyInterface  )----------------------------------------- */
  73  
  74  
  75    public function getCapabilities() {
  76      return array(
  77        PhabricatorPolicyCapability::CAN_VIEW,
  78      );
  79    }
  80  
  81    public function getPolicy($capability) {
  82      switch ($capability) {
  83        case PhabricatorPolicyCapability::CAN_VIEW:
  84          return PhabricatorPolicies::getMostOpenPolicy();
  85      }
  86    }
  87  
  88    public function hasAutomaticCapability($capability, PhabricatorUser $viewer) {
  89      return false;
  90    }
  91  
  92    public function describeAutomaticCapability($capability) {
  93      return null;
  94    }
  95  }


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