Matthias Andreas Benkard | 1ba5381 | 2022-12-27 17:32:58 +0100 | [diff] [blame^] | 1 | <?php |
| 2 | |
| 3 | namespace LdapRecord\Events; |
| 4 | |
| 5 | class NullDispatcher implements DispatcherInterface |
| 6 | { |
| 7 | /** |
| 8 | * The underlying dispatcher instance. |
| 9 | * |
| 10 | * @var DispatcherInterface |
| 11 | */ |
| 12 | protected $dispatcher; |
| 13 | |
| 14 | /** |
| 15 | * Constructor. |
| 16 | * |
| 17 | * @param DispatcherInterface $dispatcher |
| 18 | */ |
| 19 | public function __construct(DispatcherInterface $dispatcher) |
| 20 | { |
| 21 | $this->dispatcher = $dispatcher; |
| 22 | } |
| 23 | |
| 24 | /** |
| 25 | * Register an event listener with the dispatcher. |
| 26 | * |
| 27 | * @param string|array $events |
| 28 | * @param mixed $listener |
| 29 | * |
| 30 | * @return void |
| 31 | */ |
| 32 | public function listen($events, $listener) |
| 33 | { |
| 34 | $this->dispatcher->listen($events, $listener); |
| 35 | } |
| 36 | |
| 37 | /** |
| 38 | * Determine if a given event has listeners. |
| 39 | * |
| 40 | * @param string $eventName |
| 41 | * |
| 42 | * @return bool |
| 43 | */ |
| 44 | public function hasListeners($eventName) |
| 45 | { |
| 46 | return $this->dispatcher->hasListeners($eventName); |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * Fire an event until the first non-null response is returned. |
| 51 | * |
| 52 | * @param string|object $event |
| 53 | * @param mixed $payload |
| 54 | * |
| 55 | * @return null |
| 56 | */ |
| 57 | public function until($event, $payload = []) |
| 58 | { |
| 59 | return null; |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | * Fire an event and call the listeners. |
| 64 | * |
| 65 | * @param string|object $event |
| 66 | * @param mixed $payload |
| 67 | * @param bool $halt |
| 68 | * |
| 69 | * @return null |
| 70 | */ |
| 71 | public function fire($event, $payload = [], $halt = false) |
| 72 | { |
| 73 | return null; |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * Fire an event and call the listeners. |
| 78 | * |
| 79 | * @param string|object $event |
| 80 | * @param mixed $payload |
| 81 | * @param bool $halt |
| 82 | * |
| 83 | * @return null |
| 84 | */ |
| 85 | public function dispatch($event, $payload = [], $halt = false) |
| 86 | { |
| 87 | return null; |
| 88 | } |
| 89 | |
| 90 | /** |
| 91 | * Get all of the listeners for a given event name. |
| 92 | * |
| 93 | * @param string $eventName |
| 94 | * |
| 95 | * @return array |
| 96 | */ |
| 97 | public function getListeners($eventName) |
| 98 | { |
| 99 | return $this->dispatcher->getListeners($eventName); |
| 100 | } |
| 101 | |
| 102 | /** |
| 103 | * Remove a set of listeners from the dispatcher. |
| 104 | * |
| 105 | * @param string $event |
| 106 | * |
| 107 | * @return void |
| 108 | */ |
| 109 | public function forget($event) |
| 110 | { |
| 111 | $this->dispatcher->forget($event); |
| 112 | } |
| 113 | } |