Completed
Push — master ( 4407aa...f0730d )
by ANTHONIUS
22s queued 14s
created

ValidationPass::process()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 16
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 9
CRAP Score 3

Importance

Changes 0
Metric Value
cc 3
eloc 8
nc 3
nop 1
dl 0
loc 16
ccs 9
cts 9
cp 1
crap 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * This file is part of the DoyoUserBundle project.
5
 *
6
 * (c) Anthonius Munthi <[email protected]>
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
declare(strict_types=1);
13
14
namespace Doyo\UserBundle\DependencyInjection\Compiler;
15
16
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
17
use Symfony\Component\DependencyInjection\ContainerBuilder;
18
19
class ValidationPass implements CompilerPassInterface
20
{
21
    /**
22
     * {@inheritdoc}
23
     */
24 3
    public function process(ContainerBuilder $container)
25
    {
26 3
        if (!$container->hasParameter('doyo_user.storage')) {
27 1
            return;
28
        }
29
30 2
        $storage = $container->getParameter('doyo_user.storage');
31
32 2
        if ('custom' === $storage) {
33 1
            return;
34
        }
35
36 1
        $validationFile = __DIR__.'/../../Resources/config/storage-validation/'.$storage.'.yaml';
37
38 1
        $container->getDefinition('validator.builder')
39 1
            ->addMethodCall('addYamlMapping', [$validationFile]);
40
    }
41
}
42