Completed
Push — master ( 474902...a16483 )
by Andreas
17:23
created

formPass::get_prefix()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
nc 1
nop 2
dl 0
loc 5
ccs 4
cts 4
cp 1
crap 1
rs 10
c 1
b 0
f 0
1
<?php
2
namespace midcom\dependencyInjection;
3
4
use Symfony\Component\DependencyInjection\ContainerBuilder;
5
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
6
7
class formPass implements CompilerPassInterface
8
{
9 1
    public function process(ContainerBuilder $container)
10
    {
11 1
        $container->getDefinition('translator')
12 1
            ->addArgument([
13 1
                $this->get_prefix($container, 'validator.builder'),
14 1
                $this->get_prefix($container, 'form.factory')
15
            ]);
16 1
    }
17
18 1
    private static function get_prefix(ContainerBuilder $container, string $id) : string
19
    {
20 1
        $service = $container->getDefinition($id);
21 1
        $rc = new \ReflectionClass($service->getClass());
22 1
        return dirname($rc->getFileName()) . '/Resources/translations/validators.';
23
    }
24
}