* @license PHP License * @package WB * @subpackage base */ WBClass::load('WBEvent_Handler'); /** * WBEvent_Handler_StopOnHolidy * * Set event data * * @version 0.1.0 * @package Wombat * @subpackage base */ class WBEvent_Handler_StopOnHoliday extends WBEvent_Handler { /** * Handler config * * - mode "stop" (default) or "continue" * * @var array */ protected $config = array( 'mode' => 'stop' ); /** * @var WBDatasource_Holiday */ private $holiday; /** * constructor * */ public function __construct() { $this->holiday = WBClass::create('WBDatasource_Holiday'); } /** * Stop Event Processing on Holiday * * @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) { $res = $this->holiday->isHoliday(); switch ($this->config['mode']) { case 'continue': break; default: case 'stop': $res = !$res; break; } return $res; } }