AddPiwikClientDefinition   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 1
dl 0
loc 13
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 10 2
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