Completed
Push — experimental/sf ( 8e0ed3...253b49 )
by Kiyotaka
590:17 queued 554:36
created

PluginPass   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 83.33%

Importance

Changes 0
Metric Value
dl 0
loc 30
ccs 10
cts 12
cp 0.8333
rs 10
c 0
b 0
f 0
wmc 5
lcom 0
cbo 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 24 5
1
<?php
2
3
/*
4
 * This file is part of EC-CUBE
5
 *
6
 * Copyright(c) LOCKON CO.,LTD. All Rights Reserved.
7
 *
8
 * http://www.lockon.co.jp/
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Eccube\DependencyInjection\Compiler;
15
16
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
17
use Symfony\Component\DependencyInjection\ContainerBuilder;
18
19
class PluginPass implements CompilerPassInterface
0 ignored issues
show
introduced by
Missing class doc comment
Loading history...
20
{
21
    /**
0 ignored issues
show
introduced by
Doc comment for parameter "$container" missing
Loading history...
22
     * You can modify the container here before it is dumped to PHP code.
23
     */
24 1
    public function process(ContainerBuilder $container)
25
    {
26 1
        $plugins = $container->getParameter('eccube.plugins.disabled');
27
28 1
        if (empty($plugins)) {
29
            $container->log($this, 'disabled plugins not found.');
30
31
            return;
32
        }
33
34 1
        $definitions = $container->getDefinitions();
35
36 1
        foreach ($definitions as $definition) {
37 1
            $class = $definition->getClass();
38
39 1
            foreach ($plugins as $plugin) {
40 1
                $namespace = 'Plugin\\'.$plugin;
41
42 1
                if (false !== \strpos($class, $namespace)) {
43 1
                    $definition->clearTags();
44
                }
45
            }
46
        }
47
    }
48
}
49