Test Failed
Pull Request — master (#7)
by Jim
03:47
created

EntityManagerCompilerPass::process()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 1
1
<?php
2
3
4
namespace Jarobe\TaskRunnerBundle\DependencyInjection\Compiler;
5
6
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
7
use Symfony\Component\DependencyInjection\ContainerBuilder;
8
use Symfony\Component\DependencyInjection\Reference;
9
10
class EntityManagerCompilerPass implements CompilerPassInterface
11
{
12
13
    /**
14
     * You can modify the container here before it is dumped to PHP code.
15
     *
16
     * @param ContainerBuilder $container
17
     */
18
    public function process(ContainerBuilder $container)
19
    {
20
        $entityManagerName = $container->getParameter('jarobe.task_runner.entity_manager');
0 ignored issues
show
Unused Code introduced by
$entityManagerName 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...
21
        $entityManagerReference = new Reference('doctrine.orm.entity_manager');
22
23
        $taskEventManagerDefinition = $container->getDefinition('jarobe.task_runner.task_event_manager');
24
        $taskEventManagerDefinition->replaceArgument(0, $entityManagerReference);
25
    }
26
}