Completed
Push — master ( 8cd050...5f288c )
by Andreas
22:58
created

translatorPass::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 0
Metric Value
cc 1
eloc 3
c 0
b 0
f 0
nc 1
nop 2
dl 0
loc 5
ccs 4
cts 4
cp 1
crap 1
rs 10
1
<?php
2
namespace midcom\bundle\dependencyInjection;
3
4
use Symfony\Component\DependencyInjection\ContainerBuilder;
5
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
6
7
class translatorPass 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
}