Total Complexity | 8 |
Total Lines | 51 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
7 | class EventDispatcher |
||
8 | { |
||
9 | /** |
||
10 | * @var EventHandler[] |
||
11 | */ |
||
12 | private $handlers = []; |
||
13 | |||
14 | /** |
||
15 | * EventDispatcher constructor. |
||
16 | */ |
||
17 | public function __construct() |
||
19 | } |
||
20 | |||
21 | /** |
||
22 | * @param string $eventName |
||
23 | * @param EventHandler $handler |
||
24 | * @return EventDispatcher |
||
25 | */ |
||
26 | public function addHandler(string $eventName, EventHandler $handler): self |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * @param string $event |
||
37 | * @param object|null $context |
||
38 | * @param array|null $info |
||
39 | * @return Event |
||
40 | */ |
||
41 | public function triggerEvent(string $event, object $context = null, array $info = null): Event |
||
60 |