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 | 8 | public function attach(string $event, callable $callback, int $priority = 0): bool |
|
36 | |||
37 | /** |
||
38 | * @inheritDoc |
||
39 | */ |
||
40 | 2 | public function detach(string $event, callable $callback): bool |
|
53 | |||
54 | /** |
||
55 | * @inheritDoc |
||
56 | */ |
||
57 | 2 | public function clearListeners(string $event): void |
|
63 | |||
64 | /** |
||
65 | * @inheritDoc |
||
66 | */ |
||
67 | 8 | public function trigger($event, $target = null, array $argv = []) |
|
82 | |||
83 | 8 | private function getListenersForEvent(EventInterface $event): array |
|
102 | } |
||
103 |