FormExtensionPass::process()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 7
nc 2
nop 1
1
<?php
2
3
namespace Psi\Bundle\ContentType\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 FormExtensionPass implements CompilerPassInterface
10
{
11
    public function process(ContainerBuilder $container)
12
    {
13
        if (!$container->has('form.registry')) {
14
            return;
15
        }
16
17
        $registryDef = $container->getDefinition('form.registry');
18
        $extensions = $registryDef->getArgument(0);
19
        $extensions[] = new Reference('psi_content_type.form.extension.field');
20
        $registryDef->replaceArgument(0, $extensions);
21
    }
22
}
23