/
NullDispatcher.php
113 lines (103 loc) · 2.27 KB
/
NullDispatcher.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?php
namespace LdapRecord\Events;
class NullDispatcher implements DispatcherInterface
{
/**
* The underlying dispatcher instance.
*
* @var DispatcherInterface
*/
protected $dispatcher;
/**
* Constructor.
*
* @param DispatcherInterface $dispatcher
*/
public function __construct(DispatcherInterface $dispatcher)
{
$this->dispatcher = $dispatcher;
}
/**
* Register an event listener with the dispatcher.
*
* @param string|array $events
* @param mixed $listener
*
* @return void
*/
public function listen($events, $listener)
{
$this->dispatcher->listen($events, $listener);
}
/**
* Determine if a given event has listeners.
*
* @param string $eventName
*
* @return bool
*/
public function hasListeners($eventName)
{
return $this->dispatcher->hasListeners($eventName);
}
/**
* Fire an event until the first non-null response is returned.
*
* @param string|object $event
* @param mixed $payload
*
* @return null
*/
public function until($event, $payload = [])
{
return null;
}
/**
* Fire an event and call the listeners.
*
* @param string|object $event
* @param mixed $payload
* @param bool $halt
*
* @return null
*/
public function fire($event, $payload = [], $halt = false)
{
return null;
}
/**
* Fire an event and call the listeners.
*
* @param string|object $event
* @param mixed $payload
* @param bool $halt
*
* @return null
*/
public function dispatch($event, $payload = [], $halt = false)
{
return null;
}
/**
* Get all of the listeners for a given event name.
*
* @param string $eventName
*
* @return array
*/
public function getListeners($eventName)
{
return $this->dispatcher->getListeners($eventName);
}
/**
* Remove a set of listeners from the dispatcher.
*
* @param string $event
*
* @return void
*/
public function forget($event)
{
$this->dispatcher->forget($event);
}
}