Completed
Pull Request — master (#4)
by ANTHONIUS
05:57
created

ValidationPass   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 21
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 16 3
1
<?php
2
3
4
namespace Doyo\UserBundle\DependencyInjection\Compiler;
5
6
7
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
8
use Symfony\Component\DependencyInjection\ContainerBuilder;
9
10
class ValidationPass implements CompilerPassInterface
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15 3
    public function process(ContainerBuilder $container)
16
    {
17 3
        if (!$container->hasParameter('doyo_user.storage')) {
18 1
            return;
19
        }
20
21 2
        $storage = $container->getParameter('doyo_user.storage');
22
23 2
        if ('custom' === $storage) {
24 1
            return;
25
        }
26
27 1
        $validationFile = __DIR__.'/../../Resources/config/storage-validation/'.$storage.'.yaml';
28
29 1
        $container->getDefinition('validator.builder')
30 1
            ->addMethodCall('addYamlMapping', array($validationFile));
31
    }
32
}