1 | <?php |
||
20 | abstract class AbstractDelegateSubscriber extends AbstractSubscriber implements DelegateSubscriberInterface |
||
21 | { |
||
22 | /** |
||
23 | * @param Event $event |
||
24 | * @param string $eventName |
||
25 | * @param EventDispatcherInterface $eventDispatcher |
||
26 | */ |
||
27 | public function handle(Event $event, $eventName, EventDispatcherInterface $eventDispatcher) |
||
28 | { |
||
29 | $delegates = static::getDelegatedSubscribedEvents(); |
||
30 | |||
31 | if (isset($delegates[$eventName])) { |
||
32 | foreach ($delegates[$eventName] as $delegate) { |
||
33 | $eventDispatcher->dispatch($delegate, $event); |
||
34 | } |
||
35 | } |
||
36 | } |
||
37 | |||
38 | /** |
||
39 | * {@inheritdoc} |
||
40 | */ |
||
41 | 12 | public static function getSubscribedEvents() |
|
51 | } |
||
52 |