1: <?php
2:
3: 4: 5: 6: 7: 8: 9: 10:
11:
12: namespace Symfony\Component\EventDispatcher;
13:
14: 15: 16: 17: 18:
19: class ImmutableEventDispatcher implements EventDispatcherInterface
20: {
21: 22: 23: 24: 25:
26: private $dispatcher;
27:
28: 29: 30: 31: 32:
33: public function __construct(EventDispatcherInterface $dispatcher)
34: {
35: $this->dispatcher = $dispatcher;
36: }
37:
38: 39: 40:
41: public function dispatch($eventName, Event $event = null)
42: {
43: return $this->dispatcher->dispatch($eventName, $event);
44: }
45:
46: 47: 48:
49: public function addListener($eventName, $listener, $priority = 0)
50: {
51: throw new \BadMethodCallException('Unmodifiable event dispatchers must not be modified.');
52: }
53:
54: 55: 56:
57: public function addSubscriber(EventSubscriberInterface $subscriber)
58: {
59: throw new \BadMethodCallException('Unmodifiable event dispatchers must not be modified.');
60: }
61:
62: 63: 64:
65: public function removeListener($eventName, $listener)
66: {
67: throw new \BadMethodCallException('Unmodifiable event dispatchers must not be modified.');
68: }
69:
70: 71: 72:
73: public function removeSubscriber(EventSubscriberInterface $subscriber)
74: {
75: throw new \BadMethodCallException('Unmodifiable event dispatchers must not be modified.');
76: }
77:
78: 79: 80:
81: public function getListeners($eventName = null)
82: {
83: return $this->dispatcher->getListeners($eventName);
84: }
85:
86: 87: 88:
89: public function hasListeners($eventName = null)
90: {
91: return $this->dispatcher->hasListeners($eventName);
92: }
93: }
94: