Changeset View
Changeset View
Standalone View
Standalone View
src/applications/drydock/storage/DrydockBlueprint.php
<?php | <?php | ||||
final class DrydockBlueprint extends DrydockDAO | final class DrydockBlueprint extends DrydockDAO | ||||
implements PhabricatorPolicyInterface { | implements PhabricatorPolicyInterface { | ||||
protected $phid; | protected $phid; | ||||
protected $className; | protected $className; | ||||
protected $viewPolicy; | protected $viewPolicy; | ||||
protected $editPolicy; | protected $editPolicy; | ||||
protected $details; | protected $details; | ||||
private $implementation = self::ATTACHABLE; | |||||
public function getConfiguration() { | public function getConfiguration() { | ||||
return array( | return array( | ||||
self::CONFIG_AUX_PHID => true, | self::CONFIG_AUX_PHID => true, | ||||
self::CONFIG_SERIALIZATION => array( | self::CONFIG_SERIALIZATION => array( | ||||
'details' => self::SERIALIZATION_JSON, | 'details' => self::SERIALIZATION_JSON, | ||||
) | ) | ||||
) + parent::getConfiguration(); | ) + parent::getConfiguration(); | ||||
} | } | ||||
Show All 9 Lines | $implementations = | ||||
DrydockBlueprintImplementation::getAllBlueprintImplementations(); | DrydockBlueprintImplementation::getAllBlueprintImplementations(); | ||||
if (!isset($implementations[$class])) { | if (!isset($implementations[$class])) { | ||||
throw new Exception( | throw new Exception( | ||||
"Invalid class name for blueprint (got '".$class."')"); | "Invalid class name for blueprint (got '".$class."')"); | ||||
} | } | ||||
return id(new $class())->attachInstance($this); | return id(new $class())->attachInstance($this); | ||||
} | } | ||||
public function attachImplementation(DrydockBlueprintImplementation $impl) { | |||||
$this->implementation = $impl; | |||||
return $this; | |||||
} | |||||
/* -( PhabricatorPolicyInterface )----------------------------------------- */ | /* -( PhabricatorPolicyInterface )----------------------------------------- */ | ||||
public function getCapabilities() { | public function getCapabilities() { | ||||
return array( | return array( | ||||
PhabricatorPolicyCapability::CAN_VIEW, | PhabricatorPolicyCapability::CAN_VIEW, | ||||
PhabricatorPolicyCapability::CAN_EDIT, | PhabricatorPolicyCapability::CAN_EDIT, | ||||
); | ); | ||||
Show All 28 Lines |