1 | <?php |
||
58 | class DefaultImplementation implements ImplementationInterface |
||
59 | { |
||
60 | |||
61 | /** |
||
62 | * Options. |
||
63 | * |
||
64 | * @var Options |
||
65 | */ |
||
66 | protected $options; |
||
67 | |||
68 | /** |
||
69 | * Eventmanager. |
||
70 | * |
||
71 | * @var EventManagerInterface |
||
72 | */ |
||
73 | protected $events; |
||
74 | |||
75 | /** |
||
76 | * {@inheritDoc} |
||
77 | */ |
||
78 | 3 | public function register() |
|
79 | { |
||
80 | 3 | $this->registerListener(new Stream); |
|
81 | 3 | $this->registerListener(new StreamError); |
|
82 | 3 | $this->registerListener(new StartTls); |
|
83 | 3 | $this->registerListener(new Authentication); |
|
84 | 3 | $this->registerListener(new Bind); |
|
85 | 3 | $this->registerListener(new Session); |
|
86 | 3 | $this->registerListener(new RosterListener); |
|
87 | 3 | $this->registerListener(new RegisterListener); |
|
88 | 3 | $this->registerListener(new BlockedUsersListener); |
|
89 | 3 | } |
|
90 | |||
91 | /** |
||
92 | * {@inheritDoc} |
||
93 | */ |
||
94 | 3 | public function registerListener(EventListenerInterface $eventListener) |
|
95 | { |
||
96 | 3 | $connection = $this->getOptions()->getConnection(); |
|
97 | |||
98 | 3 | $eventListener->setEventManager($this->getEventManager()) |
|
99 | 3 | ->setOptions($this->getOptions()) |
|
100 | 3 | ->attachEvents(); |
|
101 | |||
102 | 3 | $connection->addListener($eventListener); |
|
103 | 3 | } |
|
104 | |||
105 | /** |
||
106 | * {@inheritDoc} |
||
107 | */ |
||
108 | 3 | public function getOptions() |
|
112 | |||
113 | /** |
||
114 | * {@inheritDoc} |
||
115 | */ |
||
116 | 3 | public function setOptions(Options $options) |
|
121 | |||
122 | /** |
||
123 | * {@inheritDoc} |
||
124 | */ |
||
125 | 3 | public function getEventManager() |
|
133 | |||
134 | /** |
||
135 | * {@inheritDoc} |
||
136 | */ |
||
137 | 3 | public function setEventManager(EventManagerInterface $events) |
|
142 | } |
||
143 |