1 | <?php |
||
15 | class DelayEventDispatcher implements EventDispatcherInterface |
||
16 | { |
||
17 | /** |
||
18 | * @var array |
||
19 | */ |
||
20 | private $eligibleEventNames = array(); |
||
21 | |||
22 | /** |
||
23 | * @var EventDispatcherInterface |
||
24 | */ |
||
25 | private $dispatcher; |
||
26 | |||
27 | /** |
||
28 | * @param EventDispatcherInterface $dispatcher |
||
29 | * @param array $eligibleEventNames |
||
30 | */ |
||
31 | public function __construct(EventDispatcherInterface $dispatcher, array $eligibleEventNames) |
||
36 | |||
37 | /** |
||
38 | * {@inheritDoc} |
||
39 | */ |
||
40 | public function dispatch($eventName, Event $event = null) |
||
58 | |||
59 | /** |
||
60 | * {@inheritDoc} |
||
61 | */ |
||
62 | public function addListener($eventName, $listener, $priority = 0) |
||
66 | |||
67 | /** |
||
68 | * {@inheritDoc} |
||
69 | */ |
||
70 | public function addSubscriber(EventSubscriberInterface $subscriber) |
||
74 | |||
75 | /** |
||
76 | * {@inheritDoc} |
||
77 | */ |
||
78 | public function removeListener($eventName, $listener) |
||
82 | |||
83 | /** |
||
84 | * {@inheritDoc} |
||
85 | */ |
||
86 | public function removeSubscriber(EventSubscriberInterface $subscriber) |
||
90 | |||
91 | /** |
||
92 | * {@inheritDoc} |
||
93 | */ |
||
94 | public function getListeners($eventName = null) |
||
98 | |||
99 | /** |
||
100 | * {@inheritDoc} |
||
101 | */ |
||
102 | public function hasListeners($eventName = null) |
||
103 | { |
||
104 | return $this->dispatcher->hasListeners($eventName); |
||
105 | } |
||
106 | |||
107 | /** |
||
108 | * Proxies all method calls to the original event dispatcher. |
||
109 | * |
||
110 | * @param string $method The method name |
||
111 | * @param array $arguments The method arguments |
||
112 | * |
||
113 | * @return mixed |
||
114 | */ |
||
115 | public function __call($method, $arguments) |
||
119 | |||
120 | /** |
||
121 | * @param String $eventName |
||
122 | * @param DelayEvent $event |
||
123 | * |
||
124 | * @return bool |
||
125 | */ |
||
126 | private function isEventEligible($eventName, DelayEvent $event) |
||
130 | } |
||
131 |