| 1 | <?php |
||
| 6 | trait EventDispatcherTrait |
||
| 7 | { |
||
| 8 | |||
| 9 | /** @var array<string, callable[]> */ |
||
| 10 | private $listeners = []; |
||
| 11 | |||
| 12 | |||
| 13 | 2 | protected function hasListeners(?string $eventName = null): bool |
|
| 17 | |||
| 18 | /** |
||
| 19 | * @param mixed $data |
||
| 20 | */ |
||
| 21 | 2 | protected function dispatch(string $eventName, $data): void |
|
| 31 | |||
| 32 | 2 | public function subscribe(string $eventName, callable $callback): void |
|
| 36 | } |
||
| 37 |