Completed
Pull Request — master (#37)
by Tobias
83:58 queued 59:44
created

PluginPass   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

1 Method

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