Completed
Push — master ( 8b8539...de5cc9 )
by Tristan
13:08 queued 08:55
created

FormatValidatorPass   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 3
dl 0
loc 17
ccs 0
cts 10
cp 0
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 11 3
1
<?php
2
3
namespace Nicofuma\SwaggerBundle\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 FormatValidatorPass implements CompilerPassInterface
10
{
11
    /**
12
     * {@inheritdoc}
13
     */
14
    public function process(ContainerBuilder $container)
15
    {
16
        $formatConstraintDefinition = $container->getDefinition('swagger.json_schema.constraints.format');
17
18
        $services = $container->findTaggedServiceIds('swagger.format_validator');
19
        foreach ($services as $serviceId => $tags) {
20
            foreach ($tags as $attributes) {
21
                $formatConstraintDefinition->addMethodCall('addFormatValidator', [$attributes['format'], new Reference($serviceId)]);
22
            }
23
        }
24
    }
25
}
26