FormFactoryPass   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
B process() 0 24 2
1
<?php
2
3
namespace DoS\ResourceBundle\DependencyInjection\Compiler;
4
5
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
use Symfony\Component\DependencyInjection\Reference;
8
9
class FormFactoryPass implements CompilerPassInterface
10
{
11
    public function process(ContainerBuilder $container)
12
    {
13
        if (!$container->hasParameter('dos.form.factory.class')) {
14
            return;
15
        }
16
17
        $class = $container->getParameter('dos.form.factory.class');
18
19
        $container->setParameter('form.facotry.class', $class);
20
        $container->getDefinition('form.factory')
21
            ->setClass($class)
22
            ->addMethodCall(
23
                'setSecurityTokenStorage',
24
                array(new Reference('security.token_storage'))
25
            )
26
            ->addMethodCall(
27
                'setPrefixAndReplacement',
28
                array(
29
                    $container->getParameter('dos.form.factory.override_pattern'),
30
                    $container->getParameter('dos.form.factory.override_replacement'),
31
                )
32
            )
33
        ;
34
    }
35
}
36