Code Duplication    Length = 21-24 lines in 4 locations

src/FilterUsedFixtureService/FilterUsedFixtureServiceFactory.php 1 location

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

src/FixtureInitializer/ConnectionRegistryEventSubscriberFactory.php 1 location

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

src/FixtureInitializer/ManagerRegistryEventSubscriberFactory.php 1 location

@@ 19-42 (lines=24) @@
16
 *
17
 * @package Nnx\DoctrineFixtureModule\FixtureInitializer
18
 */
19
class ManagerRegistryEventSubscriberFactory
20
    implements FactoryInterface
21
{
22
23
24
    /**
25
     * @param ServiceLocatorInterface $serviceLocator
26
     *
27
     * @return ManagerRegistryEventSubscriber|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 instanceof AbstractPluginManager ?  $serviceLocator->getServiceLocator() : $serviceLocator;
34
35
        /** @var ManagerRegistryProviderInterface $managerRegistryProvider */
36
        $managerRegistryProvider = $appServiceLocator->get(ManagerRegistryProviderInterface::class);
37
        $managerRegistry = $managerRegistryProvider->getManagerRegistry();
38
39
40
        return new ManagerRegistryEventSubscriber($managerRegistry);
41
    }
42
}
43

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