Passed
Push — master ( c39fb6...9e9a0d )
by Rafael
04:42
created

ORMDataLoader   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 100 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 19
loc 19
ccs 0
cts 9
cp 0
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A supports() 3 3 1
A createExecutor() 6 6 1

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
 *  This file is part of the GraphQL Bundle package.
4
 *
5
 *  (c) YnloUltratech <[email protected]>
6
 *
7
 *  For the full copyright and license information, please view the LICENSE
8
 *  file that was distributed with this source code.
9
 ******************************************************************************/
10
11
namespace Ynlo\GraphQLBundle\Test\FixtureLoader\DataPopulator;
12
13
use Doctrine\Bundle\DoctrineBundle\Registry;
14
use Doctrine\Common\DataFixtures\Executor\AbstractExecutor;
15
use Doctrine\Common\DataFixtures\Executor\ORMExecutor;
16
use Doctrine\Common\DataFixtures\Purger\ORMPurger;
17
18
/**
19
 * Class ORMDataLoader
20
 */
21 View Code Duplication
class ORMDataLoader implements DataLoaderInterface
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...
22
{
23
    /**
24
     * {@inheritdoc}
25
     */
26
    public function supports(Registry $registry): bool
27
    {
28
        return $registry->getName() === 'ORM';
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    public function createExecutor(Registry $registry): AbstractExecutor
35
    {
36
        $om = $registry->getManager();
37
        $purger = new ORMPurger();
38
39
        return new ORMExecutor($om, $purger);
40
    }
41
}
42