12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <?php
- namespace Symfony\Component\EventDispatcher;
- class ImmutableEventDispatcher implements EventDispatcherInterface
- {
- private $dispatcher;
- public function __construct(EventDispatcherInterface $dispatcher)
- {
- $this->dispatcher = $dispatcher;
- }
-
- public function dispatch($eventName, Event $event = null)
- {
- return $this->dispatcher->dispatch($eventName, $event);
- }
-
- public function addListener($eventName, $listener, $priority = 0)
- {
- throw new \BadMethodCallException('Unmodifiable event dispatchers must not be modified.');
- }
-
- public function addSubscriber(EventSubscriberInterface $subscriber)
- {
- throw new \BadMethodCallException('Unmodifiable event dispatchers must not be modified.');
- }
-
- public function removeListener($eventName, $listener)
- {
- throw new \BadMethodCallException('Unmodifiable event dispatchers must not be modified.');
- }
-
- public function removeSubscriber(EventSubscriberInterface $subscriber)
- {
- throw new \BadMethodCallException('Unmodifiable event dispatchers must not be modified.');
- }
-
- public function getListeners($eventName = null)
- {
- return $this->dispatcher->getListeners($eventName);
- }
-
- public function getListenerPriority($eventName, $listener)
- {
- return $this->dispatcher->getListenerPriority($eventName, $listener);
- }
-
- public function hasListeners($eventName = null)
- {
- return $this->dispatcher->hasListeners($eventName);
- }
- }
|