ThemeProviderCompilerPass   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 20 3
1
<?php
2
3
namespace Neirda\Bundle\LiipThemeProvider\DependencyInjection\CompilerPass;
4
5
use Neirda\Bundle\LiipThemeProvider\LiipThemeProviderTags;
6
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
7
use Symfony\Component\DependencyInjection\ContainerBuilder;
8
use Symfony\Component\DependencyInjection\Reference;
9
10
class ThemeProviderCompilerPass implements CompilerPassInterface
11
{
12
    /**
13
     * Register all the theme provider in the theme container.
14
     *
15
     * {@inheritdoc}
16
     */
17
    public function process(ContainerBuilder $container)
18
    {
19
        if (!$container->has('liip_theme_provider.theme_container')) {
20
            return;
21
        }
22
23
        $definition = $container->findDefinition(
24
            'liip_theme_provider.theme_container'
25
        );
26
27
        $taggedServices = $container->findTaggedServiceIds(
28
            LiipThemeProviderTags::THEME_PROVIDER
29
        );
30
        foreach ($taggedServices as $id => $tags) {
31
            $definition->addMethodCall(
32
                'addThemeProvider',
33
                array(new Reference($id))
34
            );
35
        }
36
    }
37
}
38