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

CachedORMDataLoader::supports()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 3
Ratio 100 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 3
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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\Purger\ORMPurger;
16
use Doctrine\ORM\EntityManagerInterface;
17
use Ynlo\GraphQLBundle\Test\FixtureLoader\Cache\CachedFixtureExecutor;
18
use Ynlo\GraphQLBundle\Test\FixtureLoader\Cache\CachedFixtureEntityManager;
19
20
/**
21
 * Class CachedORMDataLoader
22
 */
23 View Code Duplication
class CachedORMDataLoader 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...
24
{
25
    /**
26
     * {@inheritdoc}
27
     */
28 21
    public function supports(Registry $registry): bool
29
    {
30 21
        return $registry->getName() === 'ORM';
31
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36 21
    public function createExecutor(Registry $registry): AbstractExecutor
37
    {
38
        /** @var EntityManagerInterface $em */
39 21
        $em = $registry->getManager();
40 21
        $om = new CachedFixtureEntityManager($em);
41 21
        $purger = new ORMPurger();
42
43 21
        return new CachedFixtureExecutor($om, $purger);
44
    }
45
}
46