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

DoctrineOrmCompilerPass   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 13 3
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