* @license PHP License * @package WB * @subpackage base */ WBClass::load('WBEvent_Handler' , 'WBEvent_Handler_Statistic'); /** * Event_Handler_Statistic_Counter * * Count generic statistic events * * @version 0.1.0 * @package WB * @subpackage base */ class WBEvent_Handler_Statistic_Counter extends WBEvent_Handler_Statistic { /** * Handler config * * Parameters: * - namespace * - path * * @var array */ protected $config = array( 'namespace' => '', 'path' => '%s', 'pathindex' => '' ); /** * Process event * * Count 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) { $path = $this->config['path']; if (!empty($this->config['pathindex'])) { $p = $e->get($this->config['pathindex'], ''); $path = sprintf($path, $p); } /** @var WBStatistic_Generic */ $stat = WBClass::create('WBStatistic_Generic'); $stat->setNamespace($this->config['namespace']); $stat->add($path); return true; } }