Completed
Pull Request — master (#37)
by Tobias
103:48 queued 88:26
created

PluginPass::process()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 10
rs 9.2
cc 4
eloc 5
nc 4
nop 1
1
<?php
2
3
namespace Http\HttplugBundle\DependencyInjection\CompilerPass;
4
5
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
8
/**
9
 * Remove plugins if their dependencies are missing.
10
 *
11
 * @author Tobias Nyholm <[email protected]>
12
 */
13
class PluginPass implements CompilerPassInterface
14
{
15
    /**
16
     * {@inheritdoc}
17
     */
18
    public function process(ContainerBuilder $container)
19
    {
20
        if (!($container->hasDefinition('logger') || $container->hasAlias('logger'))) {
21
            $container->removeDefinition('httplug.plugin.logger');
22
        }
23
24
        if (!$container->hasDefinition('debug.stopwatch')) {
25
            $container->removeDefinition('httplug.plugin.stopwatch');
26
        }
27
    }
28
}
29