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

PluginPass::process()   A

Complexity

Conditions 5
Paths 5

Size

Total Lines 24

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 5.1158

Importance

Changes 0
Metric Value
cc 5
nc 5
nop 1
dl 0
loc 24
ccs 10
cts 12
cp 0.8333
crap 5.1158
rs 9.2248
c 0
b 0
f 0
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