1 | <?php |
||
6 | class EventManager implements EventManagerInterface |
||
7 | { |
||
8 | /** |
||
9 | * @var array |
||
10 | * |
||
11 | * ex) |
||
12 | * [ |
||
13 | * 'eventName' => [ |
||
14 | * ['priority' => 1, 'callback' => [self::class, 'methodName']] |
||
15 | * ], |
||
16 | * ]; |
||
17 | */ |
||
18 | private $listenerMapping = []; |
||
19 | |||
20 | /** |
||
21 | * @inheritDoc |
||
22 | */ |
||
23 | public function attach(string $event, callable $callback, int $priority = 0) |
||
34 | |||
35 | /** |
||
36 | * @inheritDoc |
||
37 | */ |
||
38 | public function clearListeners(string $event) |
||
44 | |||
45 | /** |
||
46 | * @inheritDoc |
||
47 | */ |
||
48 | public function detach(string $event, callable $callback) |
||
59 | |||
60 | /** |
||
61 | * @inheritDoc |
||
62 | */ |
||
63 | public function trigger($event, $target = null, array $argv = []) |
||
78 | |||
79 | private function getListenersForEvent(EventInterface $event): array |
||
98 | } |
||
99 |