ClassLoaderFactory   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A createService() 8 8 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\Loader;
7
8
use Zend\ServiceManager\FactoryInterface;
9
use Zend\ServiceManager\MutableCreationOptionsInterface;
10
use Zend\ServiceManager\MutableCreationOptionsTrait;
11
use Zend\ServiceManager\ServiceLocatorInterface;
12
use Doctrine\Fixture\Loader\ClassLoader;
13
14
/**
15
 * Class ClassLoaderFactory
16
 *
17
 * @package Nnx\DoctrineFixtureModule\Loader
18
 */
19 View Code Duplication
class ClassLoaderFactory
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
    implements FactoryInterface,
0 ignored issues
show
Coding Style introduced by
The implements keyword must be on the same line as the class name
Loading history...
Coding Style introduced by
The first item in a multi-line implements list must be on the line following the implements keyword
Loading history...
21
    MutableCreationOptionsInterface
22
{
23
    use MutableCreationOptionsTrait;
24
25
    /**
26
     * @param ServiceLocatorInterface $serviceLocator
27
     *
28
     * @return ClassLoader
29
     */
30
    public function createService(ServiceLocatorInterface $serviceLocator)
31
    {
32
        $creationOptions = $this->getCreationOptions();
33
34
        $classList = array_key_exists('classList', $creationOptions) ? $creationOptions['classList'] : [];
35
36
        return new ClassLoader($classList);
37
    }
38
}
39