Changeset View
Changeset View
Standalone View
Standalone View
src/applications/herald/adapter/HeraldAdapter.php
Show First 20 Lines • Show All 180 Lines • ▼ Show 20 Lines | abstract class HeraldAdapter extends Phobject { | ||||
* if you want to react to them. | * if you want to react to them. | ||||
* | * | ||||
* @return list<PhabricatorApplicationTransaction> List of transactions. | * @return list<PhabricatorApplicationTransaction> List of transactions. | ||||
*/ | */ | ||||
final public function getAppliedTransactions() { | final public function getAppliedTransactions() { | ||||
return $this->appliedTransactions; | return $this->appliedTransactions; | ||||
} | } | ||||
public function queueTransaction($transaction) { | final public function queueTransaction( | ||||
PhabricatorApplicationTransaction $transaction) { | |||||
$this->queuedTransactions[] = $transaction; | $this->queuedTransactions[] = $transaction; | ||||
} | } | ||||
public function getQueuedTransactions() { | final public function getQueuedTransactions() { | ||||
return $this->queuedTransactions; | return $this->queuedTransactions; | ||||
} | } | ||||
public function newTransaction() { | final public function newTransaction() { | ||||
$object = $this->newObject(); | $object = $this->newObject(); | ||||
if (!($object instanceof PhabricatorApplicationTransactionInterface)) { | if (!($object instanceof PhabricatorApplicationTransactionInterface)) { | ||||
throw new Exception( | throw new Exception( | ||||
pht( | pht( | ||||
'Unable to build a new transaction for adapter object; it does '. | 'Unable to build a new transaction for adapter object; it does '. | ||||
'not implement "%s".', | 'not implement "%s".', | ||||
'PhabricatorApplicationTransactionInterface')); | 'PhabricatorApplicationTransactionInterface')); | ||||
} | } | ||||
return $object->getApplicationTransactionTemplate(); | $xaction = $object->getApplicationTransactionTemplate(); | ||||
if (!($xaction instanceof PhabricatorApplicationTransaction)) { | |||||
throw new Exception( | |||||
pht( | |||||
'Expected object (of class "%s") to return a transaction template '. | |||||
'(of class "%s"), but it returned something else ("%s").', | |||||
get_class($object), | |||||
'PhabricatorApplicationTransaction', | |||||
phutil_describe_type($xaction))); | |||||
} | |||||
return $xaction; | |||||
} | } | ||||
/** | /** | ||||
* NOTE: You generally should not override this; it exists to support legacy | * NOTE: You generally should not override this; it exists to support legacy | ||||
* adapters which had hard-coded content types. | * adapters which had hard-coded content types. | ||||
*/ | */ | ||||
public function getAdapterContentType() { | public function getAdapterContentType() { | ||||
▲ Show 20 Lines • Show All 1,018 Lines • Show Last 20 Lines |