Code Duplication    Length = 11-12 lines in 2 locations

module/Core/src/Core/Factory/EventManager/EventManagerAbstractFactory.php 2 locations

@@ 189-200 (lines=12) @@
186
    {
187
        /* @var \Zend\EventManager\EventManagerInterface|\Core\EventManager\EventProviderInterface $events */
188
189
        if ($services->has($config['service'])) {
190
            $events = $services->get($config['service']);
191
192
        } else {
193
            if (!class_exists($config['service'], true)) {
194
                throw new \UnexpectedValueException(sprintf(
195
                    'Class or service %s does not exists. Cannot create event manager instance.', $config['service']
196
                ));
197
            }
198
199
            $events = new $config['service']();
200
        }
201
202
        if (false === $config['configure']) {
203
            return $events;
@@ 254-264 (lines=11) @@
251
                continue;
252
            }
253
254
            if ($services->has($options['service'])) {
255
                $listener = $services->get($options['service']);
256
257
            } else if (class_exists($options['service'], true)) {
258
                $listener = new $options['service']();
259
260
            } else {
261
                throw new \UnexpectedValueException(sprintf(
262
                                                        'Class or service %s does not exists. Cannot create listener instance.', $options['service']
263
                                                    ));
264
            }
265
266
            if ($listener instanceOf ListenerAggregateInterface) {
267
                $listener->attach($eventManager, $options['priority']);