Code Duplication    Length = 11-13 lines in 2 locations

module/Core/src/Core/Factory/EventManager/EventManagerAbstractFactory.php 1 location

@@ 120-130 (lines=11) @@
117
                    continue;
118
                }
119
120
                if ($serviceLocator->has($listener)) {
121
                    $listener = $serviceLocator->get($listener);
122
123
                } else if (class_exists($listener, true)) {
124
                    $listener = new $listener();
125
126
                } else {
127
                    throw new \UnexpectedValueException(sprintf(
128
                        'Class %s does not exists. Cannot create listener instance.', $listener
129
                    ));
130
                }
131
132
                if ($isAggregate) {
133
                    $listener->attach($events);

module/Core/src/Core/Listener/DeferredListenerAggregate.php 1 location

@@ 126-138 (lines=13) @@
123
        if (!$listener) {
124
            $services = $this->getServiceLocator();
125
126
            if ($services->has($service)) {
127
                $listener = $services->get($service);
128
129
            } else {
130
                if (!class_exists($service, true)) {
131
                    throw new \UnexpectedValueException(sprintf(
132
                        'Cannot create deferred listener "%s", because the class does not exist.',
133
                        $service
134
                    ));
135
                }
136
137
                $listener = new $service();
138
            }
139
140
            $this->hooks[$name]['instance'] = $listener;
141
        }