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

TemplatingPass::process()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 11
rs 9.4286
cc 3
eloc 6
nc 3
nop 1
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