Completed
Push — master ( e63237...cdb730 )
by Jarek
11s
created

ValidationCompilerPass   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 17 3
1
<?php
2
3
/**
4
 * (c) FSi sp. z o.o. <[email protected]>
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 */
9
10
namespace FSi\Bundle\AdminSecurityBundle\DependencyInjection\Compiler;
11
12
use Symfony\Component\DependencyInjection\ContainerBuilder;
13
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
14
15
class ValidationCompilerPass implements CompilerPassInterface
16
{
17
    /**
18
     * {@inheritDoc}
19
     */
20
    public function process(ContainerBuilder $container)
21
    {
22
        if (!$container->hasParameter('admin_security.storage')) {
23
            return;
24
        }
25
26
        if (!$container->hasDefinition('validator.builder')) {
27
            return;
28
        }
29
30
        $storage = $container->getParameter('admin_security.storage');
31
32
        $validationFile = __DIR__ . '/../../Resources/config/storage-validation/' . $storage . '.xml';
33
34
        $container->getDefinition('validator.builder')
35
            ->addMethodCall('addXmlMapping', [$validationFile]);
36
    }
37
}
38