Code Duplication    Length = 23-27 lines in 3 locations

src/Controller/ExecutorControllerFactory.php 1 location

@@ 19-41 (lines=23) @@
16
 *
17
 * @package Nnx\DoctrineFixtureModule\Entity
18
 */
19
class ExecutorControllerFactory implements FactoryInterface
20
{
21
    /**
22
     * @inheritDoc
23
     *
24
     * @return ExecutorController
25
     * @throws \Zend\ServiceManager\Exception\ServiceNotFoundException
26
     */
27
    public function createService(ServiceLocatorInterface $serviceLocator)
28
    {
29
        $appServiceLocator = $serviceLocator;
30
        if ($serviceLocator instanceof AbstractPluginManager) {
31
            $appServiceLocator = $serviceLocator->getServiceLocator();
32
        }
33
        /** @var ManagerRegistryProviderInterface $managerRegistryProvider */
34
        $managerRegistryProvider = $appServiceLocator->get(ManagerRegistryProviderInterface::class);
35
        /** @var FixtureExecutorManagerInterface $fixtureExecutorManager */
36
        $fixtureExecutorManager = $appServiceLocator->get(FixtureExecutorManagerInterface::class);
37
38
39
        return new ExecutorController($managerRegistryProvider, $fixtureExecutorManager);
40
    }
41
}
42

src/Listener/ConnectionRegistryEventSubscriberFactory.php 1 location

@@ 20-44 (lines=25) @@
17
 *
18
 * @package Nnx\DoctrineFixtureModule\Listener
19
 */
20
class ConnectionRegistryEventSubscriberFactory
21
    implements FactoryInterface
22
{
23
24
    /**
25
     * @param ServiceLocatorInterface $serviceLocator
26
     *
27
     * @return ConnectionRegistryEventSubscriber|mixed
28
     * @throws \Zend\ServiceManager\Exception\ServiceNotFoundException
29
     * @throws \Nnx\DoctrineFixtureModule\Utils\Exception\RuntimeException
30
     */
31
    public function createService(ServiceLocatorInterface $serviceLocator)
32
    {
33
        $appServiceLocator = $serviceLocator;
34
        if ($serviceLocator instanceof AbstractPluginManager) {
35
            $appServiceLocator = $serviceLocator->getServiceLocator();
36
        }
37
38
        /** @var ManagerRegistryProviderInterface $managerRegistryProvider */
39
        $managerRegistryProvider = $appServiceLocator->get(ManagerRegistryProviderInterface::class);
40
        $managerRegistry = $managerRegistryProvider->getManagerRegistry();
41
42
        return new ConnectionRegistryEventSubscriber($managerRegistry);
43
    }
44
}
45

src/Listener/ManagerRegistryEventSubscriberFactory.php 1 location

@@ 20-46 (lines=27) @@
17
 *
18
 * @package Nnx\DoctrineFixtureModule\Filter
19
 */
20
class ManagerRegistryEventSubscriberFactory
21
    implements FactoryInterface
22
{
23
24
25
    /**
26
     * @param ServiceLocatorInterface $serviceLocator
27
     *
28
     * @return ManagerRegistryEventSubscriber|mixed
29
     * @throws \Zend\ServiceManager\Exception\ServiceNotFoundException
30
     * @throws \Nnx\DoctrineFixtureModule\Utils\Exception\RuntimeException
31
     */
32
    public function createService(ServiceLocatorInterface $serviceLocator)
33
    {
34
        $appServiceLocator = $serviceLocator;
35
        if ($serviceLocator instanceof AbstractPluginManager) {
36
            $appServiceLocator = $serviceLocator->getServiceLocator();
37
        }
38
39
        /** @var ManagerRegistryProviderInterface $managerRegistryProvider */
40
        $managerRegistryProvider = $appServiceLocator->get(ManagerRegistryProviderInterface::class);
41
        $managerRegistry = $managerRegistryProvider->getManagerRegistry();
42
43
44
        return new ManagerRegistryEventSubscriber($managerRegistry);
45
    }
46
}
47