Matthias Andreas Benkard | 7b2a3a1 | 2021-08-16 10:57:25 +0200 | [diff] [blame^] | 1 | <?php |
| 2 | |
| 3 | namespace LdapRecord\Events; |
| 4 | |
| 5 | interface DispatcherInterface |
| 6 | { |
| 7 | /** |
| 8 | * Register an event listener with the dispatcher. |
| 9 | * |
| 10 | * @param string|array $events |
| 11 | * @param mixed $listener |
| 12 | * |
| 13 | * @return void |
| 14 | */ |
| 15 | public function listen($events, $listener); |
| 16 | |
| 17 | /** |
| 18 | * Determine if a given event has listeners. |
| 19 | * |
| 20 | * @param string $eventName |
| 21 | * |
| 22 | * @return bool |
| 23 | */ |
| 24 | public function hasListeners($eventName); |
| 25 | |
| 26 | /** |
| 27 | * Fire an event until the first non-null response is returned. |
| 28 | * |
| 29 | * @param string|object $event |
| 30 | * @param mixed $payload |
| 31 | * |
| 32 | * @return array|null |
| 33 | */ |
| 34 | public function until($event, $payload = []); |
| 35 | |
| 36 | /** |
| 37 | * Fire an event and call the listeners. |
| 38 | * |
| 39 | * @param string|object $event |
| 40 | * @param mixed $payload |
| 41 | * @param bool $halt |
| 42 | * |
| 43 | * @return mixed |
| 44 | */ |
| 45 | public function fire($event, $payload = [], $halt = false); |
| 46 | |
| 47 | /** |
| 48 | * Fire an event and call the listeners. |
| 49 | * |
| 50 | * @param string|object $event |
| 51 | * @param mixed $payload |
| 52 | * @param bool $halt |
| 53 | * |
| 54 | * @return array|null |
| 55 | */ |
| 56 | public function dispatch($event, $payload = [], $halt = false); |
| 57 | |
| 58 | /** |
| 59 | * Get all of the listeners for a given event name. |
| 60 | * |
| 61 | * @param string $eventName |
| 62 | * |
| 63 | * @return array |
| 64 | */ |
| 65 | public function getListeners($eventName); |
| 66 | |
| 67 | /** |
| 68 | * Remove a set of listeners from the dispatcher. |
| 69 | * |
| 70 | * @param string $event |
| 71 | * |
| 72 | * @return void |
| 73 | */ |
| 74 | public function forget($event); |
| 75 | } |