<?php
namespace Moto\System\Event; use Moto; class Firewall { protected $_map = array(); public function add($event, $callback = null, $callbackHandler = null) { if (!isset($this->_map[$event])) { $this->_map[$event] = array(); } $this->_map[$event][$callback] = $callbackHandler; } public function isExists($event, $callback = null) { $exists = true; $exists &= !empty($this->_map[$event]); if (null !== $callback) { $exists &= !empty($this->_map[$event][$callback]); } return $exists; } public function getCallbackHandler($event, $callback, $default = null) { if (!empty($this->_map[$event][$callback])) { return $this->_map[$event][$callback]; } return $default; } } 