FormTypePass   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
eloc 9
c 1
b 0
f 1
dl 0
loc 23
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 16 3
1
<?php
2
3
4
namespace oliverde8\ComfyBundle\DependencyInjection\Compiler;
5
6
use oliverde8\ComfyBundle\Form\Type\ConfigsForm;
7
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
8
use Symfony\Component\DependencyInjection\ContainerBuilder;
9
use Symfony\Component\DependencyInjection\Reference;
10
11
class FormTypePass implements CompilerPassInterface
12
{
13
    /**
14
     * Register all data providers to the Manager.
15
     *
16
     * @param ContainerBuilder $container
17
     */
18
    public function process(ContainerBuilder $container)
19
    {
20
        if (!$container->has(ConfigsForm::class)) {
21
            return;
22
        }
23
        $definition = $container->getDefinition(ConfigsForm::class);
24
25
        // Find all config's
26
        $providerDefinitions = $container->findTaggedServiceIds('comfy.form_provider');
27
        $providerReferences = [];
28
29
        foreach ($providerDefinitions as $id => $tags) {
30
            $providerReferences[] = new Reference($id);
31
        }
32
33
        $definition->setArgument('$formTypeProviders', $providerReferences);
34
    }
35
}