Completed
Push — master ( 4ff9cc...589f5d )
by Pavel
07:24
created

DoctrineOrmCompilerPass::process()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 13
rs 9.4285
cc 3
eloc 7
nc 3
nop 1
1
<?php
2
3
namespace ScayTrase\Api\Cruds\DependencyInjection\Compiler;
4
5
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
use Symfony\Component\DependencyInjection\Reference;
8
9
class DoctrineOrmCompilerPass implements CompilerPassInterface
10
{
11
    /** {@inheritdoc} */
12
    public function process(ContainerBuilder $container)
13
    {
14
        if (!$container->has('doctrine')) {
15
            return;
16
        }
17
18
        $factory = $container->getDefinition('cruds.factory.reflection');
19
        $factory->setFactory([new Reference('cruds.factory.doctrine_reflection'), 'create']);
20
21
        if ($container->has('cruds.processor.property_access')) {
22
            $processor = $container->getDefinition('cruds.processor.property_access');
0 ignored issues
show
Unused Code introduced by
$processor is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
23
        }
24
    }
25
}
26