Page MenuHomePhabricator
Paste P1116

HeraldCustomAction.php
ActivePublic

Authored by hach-que on Apr 16 2014, 6:10 AM.
Tags
None
Referenced Files
F144260: HeraldCustomAction.php
Apr 16 2014, 6:10 AM
Subscribers
None
<?php
abstract class HeraldCustomAction {
public abstract function appliesToAdapter(HeraldAdapter $adapter);
public abstract function getAvailableActions(HeraldAdapter $adapter);
public abstract function applyAction($object, $action);
}
final class RiskReviewHeraldCustomAction extends HeraldCustomAction {
public function appliesToAdapter(HeraldAdapter $adapter) {
return $adapter instanceof HeraldDifferentialRevisionAdapter;
}
public function getAvailableActions(HeraldAdapter $adapter) {
return array(
'add-risk' => array(
'name' => 'Add risk rating',
'type' => 'text'));
}
public function applyAction($object, $action) {
switch ($action) {
case 'add-risk':
// TODO: Do something with the DifferentialRevision $object.
break;
}
}
}

Event Timeline

hach-que changed the title of this paste from untitled to HeraldCustomAction.php.
hach-que updated the paste's language from autodetect to autodetect.