Changeset View
Changeset View
Standalone View
Standalone View
src/applications/herald/adapter/HeraldAdapter.php
Show All 31 Lines | abstract class HeraldAdapter extends Phobject { | ||||
private $applicationEmail; | private $applicationEmail; | ||||
private $appliedTransactions = array(); | private $appliedTransactions = array(); | ||||
private $queuedTransactions = array(); | private $queuedTransactions = array(); | ||||
private $emailPHIDs = array(); | private $emailPHIDs = array(); | ||||
private $forcedEmailPHIDs = array(); | private $forcedEmailPHIDs = array(); | ||||
private $fieldMap; | private $fieldMap; | ||||
private $actionMap; | private $actionMap; | ||||
private $edgeCache = array(); | private $edgeCache = array(); | ||||
private $forbiddenActions = array(); | |||||
public function getEmailPHIDs() { | public function getEmailPHIDs() { | ||||
return array_values($this->emailPHIDs); | return array_values($this->emailPHIDs); | ||||
} | } | ||||
public function getForcedEmailPHIDs() { | public function getForcedEmailPHIDs() { | ||||
return array_values($this->forcedEmailPHIDs); | return array_values($this->forcedEmailPHIDs); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,063 Lines • ▼ Show 20 Lines | if (!isset($this->edgeCache[$type])) { | ||||
$this->getObject()->getPHID(), | $this->getObject()->getPHID(), | ||||
$type); | $type); | ||||
$this->edgeCache[$type] = array_fuse($phids); | $this->edgeCache[$type] = array_fuse($phids); | ||||
} | } | ||||
return $this->edgeCache[$type]; | return $this->edgeCache[$type]; | ||||
} | } | ||||
/* -( Forbidden Actions )-------------------------------------------------- */ | |||||
final public function getForbiddenActions() { | |||||
return array_keys($this->forbiddenActions); | |||||
} | |||||
final public function setForbiddenAction($action, $reason) { | |||||
$this->forbiddenActions[$action] = $reason; | |||||
return $this; | |||||
} | |||||
final public function getRequiredFieldStates($field_key) { | |||||
return $this->requireFieldImplementation($field_key) | |||||
->getRequiredAdapterStates(); | |||||
} | |||||
final public function getRequiredActionStates($action_key) { | |||||
return $this->requireActionImplementation($action_key) | |||||
->getRequiredAdapterStates(); | |||||
} | |||||
final public function getForbiddenReason($action) { | |||||
if (!isset($this->forbiddenActions[$action])) { | |||||
throw new Exception( | |||||
pht( | |||||
'Action "%s" is not forbidden!', | |||||
$action)); | |||||
} | |||||
return $this->forbiddenActions[$action]; | |||||
} | |||||
} | } |