<?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;
}
}
}