| 1 | <?php |
||
| 5 | class EventDispatcher |
||
| 6 | { |
||
| 7 | private $listeners = array(); |
||
| 8 | |||
| 9 | public function addSubscriber(EventSubscriberInterface $subscriber) |
||
| 10 | { |
||
| 11 | foreach ($subscriber->getSubscribedEvents() as $key => $value) { |
||
| 12 | $this->listeners[$key][] = [$subscriber, $value]; |
||
| 13 | } |
||
| 14 | } |
||
| 15 | |||
| 16 | public function hasListeners($eventName) |
||
| 24 | |||
| 25 | 6 | public function dispatch($eventName, Event $event) |
|
| 35 | } |
||
| 36 |