Changeset View
Changeset View
Standalone View
Standalone View
src/applications/harbormaster/storage/HarbormasterBuildable.php
<?php | <?php | ||||
final class HarbormasterBuildable extends HarbormasterDAO | final class HarbormasterBuildable extends HarbormasterDAO | ||||
implements | implements | ||||
PhabricatorApplicationTransactionInterface, | PhabricatorApplicationTransactionInterface, | ||||
PhabricatorPolicyInterface, | PhabricatorPolicyInterface, | ||||
HarbormasterBuildableInterface { | HarbormasterBuildableInterface { | ||||
protected $buildablePHID; | protected $buildablePHID; | ||||
protected $containerPHID; | protected $containerPHID; | ||||
protected $buildableStatus; | protected $buildableStatus; | ||||
protected $isManualBuildable; | protected $isManualBuildable; | ||||
private $buildableObject = self::ATTACHABLE; | private $buildableObject = self::ATTACHABLE; | ||||
private $containerObject = self::ATTACHABLE; | private $containerObject = self::ATTACHABLE; | ||||
private $buildableHandle = self::ATTACHABLE; | |||||
private $containerHandle = self::ATTACHABLE; | |||||
private $builds = self::ATTACHABLE; | private $builds = self::ATTACHABLE; | ||||
const STATUS_BUILDING = 'building'; | const STATUS_BUILDING = 'building'; | ||||
const STATUS_PASSED = 'passed'; | const STATUS_PASSED = 'passed'; | ||||
const STATUS_FAILED = 'failed'; | const STATUS_FAILED = 'failed'; | ||||
public static function getBuildableStatusName($status) { | public static function getBuildableStatusName($status) { | ||||
switch ($status) { | switch ($status) { | ||||
Show All 39 Lines | return id(new HarbormasterBuildable()) | ||||
->setIsManualBuildable(0) | ->setIsManualBuildable(0) | ||||
->setBuildableStatus(self::STATUS_BUILDING); | ->setBuildableStatus(self::STATUS_BUILDING); | ||||
} | } | ||||
public function getMonogram() { | public function getMonogram() { | ||||
return 'B'.$this->getID(); | return 'B'.$this->getID(); | ||||
} | } | ||||
public function getURI() { | |||||
return '/'.$this->getMonogram(); | |||||
} | |||||
/** | /** | ||||
* Returns an existing buildable for the object's PHID or creates a | * Returns an existing buildable for the object's PHID or creates a | ||||
* new buildable implicitly if needed. | * new buildable implicitly if needed. | ||||
*/ | */ | ||||
public static function createOrLoadExisting( | public static function createOrLoadExisting( | ||||
PhabricatorUser $actor, | PhabricatorUser $actor, | ||||
$buildable_object_phid, | $buildable_object_phid, | ||||
$container_object_phid) { | $container_object_phid) { | ||||
▲ Show 20 Lines • Show All 151 Lines • ▼ Show 20 Lines | public function attachContainerObject($container_object) { | ||||
$this->containerObject = $container_object; | $this->containerObject = $container_object; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getContainerObject() { | public function getContainerObject() { | ||||
return $this->assertAttached($this->containerObject); | return $this->assertAttached($this->containerObject); | ||||
} | } | ||||
public function attachContainerHandle($container_handle) { | |||||
$this->containerHandle = $container_handle; | |||||
return $this; | |||||
} | |||||
public function getContainerHandle() { | |||||
return $this->assertAttached($this->containerHandle); | |||||
} | |||||
public function attachBuildableHandle($buildable_handle) { | |||||
$this->buildableHandle = $buildable_handle; | |||||
return $this; | |||||
} | |||||
public function getBuildableHandle() { | |||||
return $this->assertAttached($this->buildableHandle); | |||||
} | |||||
public function attachBuilds(array $builds) { | public function attachBuilds(array $builds) { | ||||
assert_instances_of($builds, 'HarbormasterBuild'); | assert_instances_of($builds, 'HarbormasterBuild'); | ||||
$this->builds = $builds; | $this->builds = $builds; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getBuilds() { | public function getBuilds() { | ||||
return $this->assertAttached($this->builds); | return $this->assertAttached($this->builds); | ||||
▲ Show 20 Lines • Show All 76 Lines • Show Last 20 Lines |