AddPiwikClientDefinition::process()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 1
1
<?php
2
3
namespace Devhelp\PiwikBundle\DependencyInjection\Compiler;
4
5
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
8
class AddPiwikClientDefinition implements CompilerPassInterface
9
{
10
    public function process(ContainerBuilder $container)
11
    {
12
        $clientServiceId = $container->getParameter('devhelp_piwik.client.service_id');
13
14
        if (!$container->hasDefinition($clientServiceId)) {
15
            throw new \InvalidArgumentException("$clientServiceId service does not exist");
16
        }
17
18
        $container->setAlias('devhelp_piwik.client', $clientServiceId);
19
    }
20
}
21