diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/event.php | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/core/event.php b/core/event.php index 7addb41d..672146f3 100644 --- a/core/event.php +++ b/core/event.php @@ -29,6 +29,14 @@ class Event private $listeners = array(); /** + * The last listener executed + * + * @access private + * @var string + */ + private $lastListener = ''; + + /** * The last triggered event * * @access private @@ -74,12 +82,25 @@ class Event if (isset($this->listeners[$eventName])) { foreach ($this->listeners[$eventName] as $listener) { - $listener->execute($data); // TODO: keep an history of executed actions for unit test + if ($listener->execute($data)) { + $this->lastListener = get_class($listener); + } } } } /** + * Get the last listener executed + * + * @access public + * @return string Event name + */ + public function getLastListenerExecuted() + { + return $this->lastListener; + } + + /** * Get the last fired event * * @access public |