Completed
Push — dev ( 141995...fca98e )
by Андрей
03:32
created

ExecutorControllerFactory   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 0
cbo 3
dl 23
loc 23
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A createService() 14 14 2

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
/**
3
 * @link    https://github.com/nnx-framework/doctrine-fixture-module
4
 * @author  Malofeykin Andrey  <[email protected]>
5
 */
6
namespace Nnx\DoctrineFixtureModule\Entity;
7
8
use Nnx\DoctrineFixtureModule\Executor\FixtureExecutorManagerInterface;
9
use Nnx\DoctrineFixtureModule\Utils\ManagerRegistryProviderInterface;
10
use Zend\ServiceManager\AbstractPluginManager;
11
use Zend\ServiceManager\FactoryInterface;
12
use Zend\ServiceManager\ServiceLocatorInterface;
13
14
/**
15
 * Class ExecutorControllerFactory
16
 *
17
 * @package Nnx\DoctrineFixtureModule\Entity
18
 */
19 View Code Duplication
class ExecutorControllerFactory implements FactoryInterface
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
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