Code Duplication    Length = 11-12 lines in 2 locations

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

@@ 229-240 (lines=12) @@
226
    {
227
        /* @var \Zend\EventManager\EventManagerInterface|\Core\EventManager\EventProviderInterface $events */
228
229
        if ($services->has($config['service'])) {
230
            $events = $services->get($config['service']);
231
232
        } else {
233
            if (!class_exists($config['service'], true)) {
234
                throw new \UnexpectedValueException(sprintf(
235
                    'Class or service %s does not exists. Cannot create event manager instance.', $config['service']
236
                ));
237
            }
238
239
            $events = new $config['service']();
240
        }
241
242
        if (false === $config['configure']) {
243
            return $events;
@@ 294-304 (lines=11) @@
291
                continue;
292
            }
293
294
            if ($services->has($options['service'])) {
295
                $listener = $services->get($options['service']);
296
297
            } else if (class_exists($options['service'], true)) {
298
                $listener = new $options['service']();
299
300
            } else {
301
                throw new \UnexpectedValueException(sprintf(
302
                                                        'Class or service %s does not exists. Cannot create listener instance.', $options['service']
303
                                                    ));
304
            }
305
306
            if ($listener instanceOf ListenerAggregateInterface) {
307
                $listener->attach($eventManager, $options['priority']);