ValidationPass::process()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 1
dl 0
loc 9
ccs 6
cts 6
cp 1
crap 1
rs 10
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * This file is part of the EloyekunlePermissionsBundle package.
5
 *
6
 * (c) Elijah Oyekunle <https://elijahoyekunle.com/>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Eloyekunle\PermissionsBundle\DependencyInjection\Compiler;
13
14
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
15
use Symfony\Component\DependencyInjection\ContainerBuilder;
16
17
/**
18
 * Registers the additional validators according to the storage.
19
 */
20
class ValidationPass implements CompilerPassInterface
21
{
22
    /**
23
     * {@inheritdoc}
24
     */
25 1
    public function process(ContainerBuilder $container)
26
    {
27 1
        $storage = $container->getParameter('eloyekunle_permissions.storage');
28
29 1
        $configDir = __DIR__.'/../../Resources/config';
30 1
        $validationFile = $configDir.'/storage-validation/'.$storage.'.xml';
31
32 1
        $validatorBuilder = $container->getDefinition('validator.builder');
33 1
        $validatorBuilder->addMethodCall('addXmlMappings', [[$validationFile, $configDir.'/validator/validation.xml']]);
34 1
    }
35
}
36