CommonMarkExtensionPass   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 2
Bugs 1 Features 0
Metric Value
wmc 6
c 2
b 1
f 0
lcom 0
cbo 3
dl 0
loc 22
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
B process() 0 19 6
1
<?php
2
3
/*
4
 * This is part of the webuni/commonmark-bundle package.
5
 *
6
 * (c) Martin Hasoň <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Webuni\Bundle\CommonMarkBundle\DependencyInjection\Compiler;
13
14
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
15
use Symfony\Component\DependencyInjection\ContainerBuilder;
16
use Symfony\Component\DependencyInjection\Reference;
17
18
class CommonMarkExtensionPass implements CompilerPassInterface
19
{
20
    public function process(ContainerBuilder $container)
21
    {
22
        $extensions = [];
23
        foreach ($container->findTaggedServiceIds('webuni_commonmark.extension') as $id => $tag) {
24
            $alias = isset($tag[0]['alias']) ? $tag[0]['alias'] : $id;
25
            $extensions[$alias] = $id;
26
        }
27
28
        if ($container->hasDefinition('webuni_commonmark.default_environment')) {
29
            $definition = $container->getDefinition('webuni_commonmark.default_environment');
30
            foreach ($extensions as $alias => $id) {
31
                $definition->addMethodCall('addExtension', [new Reference($id)]);
32
            }
33
        }
34
35
        foreach ($container->findTaggedServiceIds('webuni_commonmark.environment.extensions') as $id => $tag) {
0 ignored issues
show
Unused Code introduced by
This foreach statement is empty and can be removed.

This check looks for foreach loops that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.

Consider removing the loop.

Loading history...
36
            // todo
37
        }
38
    }
39
}
40