-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEventManagerInterface.php
70 lines (62 loc) · 1.69 KB
/
EventManagerInterface.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
namespace Phug;
use Phug\Event\ListenerQueue;
/**
* Interface for EventManager.
*/
interface EventManagerInterface
{
/**
* Returns current event listeners by event name.
*
* @return ListenerQueue[]
*/
public function getEventListeners();
/**
* Merge current events listeners with a given list.
*
* @param ListenerQueue[] $eventListeners event listeners by event name
*
* @return bool true on success false on failure
*/
public function mergeEventListeners($eventListeners);
/**
* Attaches a listener to an event.
*
* @param string $event the event to attach too
* @param callable $callback a callable function
* @param int $priority the priority at which the $callback executed
*
* @return bool true on success false on failure
*/
public function attach($event, $callback, $priority = 0);
/**
* Detaches a listener from an event.
*
* @param string $event the event to attach too
* @param callable $callback a callable function
*
* @return bool true on success false on failure
*/
public function detach($event, $callback);
/**
* Clear all listeners for a given event.
*
* @param string $event
*
* @return void
*/
public function clearListeners($event);
/**
* Trigger an event.
*
* Can accept an EventInterface or will create one if not passed
*
* @param string|EventInterface $event
* @param object|string $target
* @param array|object $argv
*
* @return mixed
*/
public function trigger($event, $target = null, $argv = []);
}