EventManager.php
1 <?php
2 /**
3  * wCMF - wemove Content Management Framework
4  * Copyright (C) 2005-2020 wemove digital solutions GmbH
5  *
6  * Licensed under the terms of the MIT License.
7  *
8  * See the LICENSE file distributed with this work for
9  * additional information.
10  */
11 namespace wcmf\lib\core;
12 
14 
15 /**
16  * EventManager is responsible for dispatching events
17  * to registered listeners.
18  *
19  * @author ingo herwig <ingo@wemove.com>
20  */
21 interface EventManager {
22 
23  /**
24  * Register a listener for a given event
25  * @param $eventName The event name
26  * @param $callback A php callback
27  */
28  public function addListener($eventName, $callback);
29 
30  /**
31  * Remove a listener for a given event
32  * @param $eventName The event name
33  * @param $callback A php callback
34  */
35  public function removeListener($eventName, $callback);
36 
37  /**
38  * Notify listeners about the given event.
39  * @param $eventName The event name
40  * @param $event An Event instance
41  */
42  public function dispatch($eventName, Event $event);
43 }
44 ?>
dispatch($eventName, Event $event)
Notify listeners about the given event.
EventManager is responsible for dispatching events to registered listeners.
removeListener($eventName, $callback)
Remove a listener for a given event.
Event is the base class for all events.
Definition: Event.php:18
Core classes.
Definition: namespaces.php:11
addListener($eventName, $callback)
Register a listener for a given event.