Completed
Push — master ( 6b5246...8691e9 )
by David
04:53 queued 02:40
created

TemplatingPass   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
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 17
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 11 3
1
<?php
2
3
namespace A2lix\AutoFormBundle\DependencyInjection\Compiler;
4
5
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
8
/**
9
 * @author David ALLIX
10
 */
11
class TemplatingPass implements CompilerPassInterface
12
{
13
    /**
14
     * {@inheritdoc}
15
     */
16
    public function process(ContainerBuilder $container)
17
    {
18
        if (false !== ($template = $container->getParameter('a2lix_auto_form.templating'))) {
19
            $resources = $container->getParameter('twig.form.resources');
20
21
            if (!in_array($template, $resources, true)) {
22
                $resources[] = $template;
23
                $container->setParameter('twig.form.resources', $resources);
24
            }
25
        }
26
    }
27
}
28