Completed
Pull Request — master (#341)
by De Cramer
05:04
created

UiComponentsPass   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 20
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 11 3
1
<?php
2
3
namespace eXpansion\Framework\MlComposeBundle\DependencyInjection\Compiler;
4
5
use Oliverde8\PageCompose\Service\UiComponents;
6
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
7
use Symfony\Component\DependencyInjection\ContainerBuilder;
8
use Symfony\Component\DependencyInjection\Reference;
9
10
/**
11
 * Class UiComponentsPass
12
 *
13
 * @author    de Cramer Oliver<[email protected]>
14
 * @copyright 2018 Oliverde8
15
 * @package eXpansion\Framework\MlComposeBundle\DependencyInjection\Compiler
16
 */
17
class UiComponentsPass implements CompilerPassInterface
18
{
19
    /**
20
     * Register all data providers to the Manager.
21
     *
22
     * @param ContainerBuilder $container
23
     */
24
    public function process(ContainerBuilder $container)
25
    {
26
        $componentsDefinition = $container->getDefinition(UiComponents::class);
27
28
        $components = $container->findTaggedServiceIds('exp.ui.component');
29
        foreach ($components as $id => $tags) {
30
            foreach ($tags as $attributes) {
31
                $componentsDefinition->addMethodCall('registerUiComponent', [$attributes['type'], new Reference($id)]);
32
            }
33
        }
34
    }
35
36
}