* @license PHP License * @package WB * @subpackage base */ /** * Event_Handler * * * * @version 0.1.0 * @package WB * @subpackage base */ class WBEvent_Handler extends WBStdClass { /** * Mandator * @var WBMandator */ protected $mandator; /** * configuration parameter * @var array */ protected $config = array(); /** * allow retry on failure? * @var bool */ protected $recoverable = false; /** * Constructor * */ public function __construct() { } /** * set configutration parameter * * Merge default config with actual parameter * * @param array $config */ final public function setConfig($config) { if (empty($this->mandator)) { $this->mandator = WBClass::create('WBMandator'); } $this->config = array_merge($this->config, $config); } /** * process event * * * @see isRecoverable() * @param WBEvent $e * @return bool true to continue, false to stop processing * @throws Exception in case of error */ public function process(WBEvent $e) { return true; } /** * tell whether to retry * * @return bool */ final public function isRecoverable() { return $this->recoverable; } }