ApiUrlPass   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 15
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 12 3
1
<?php
2
3
namespace Knp\FriendlyContexts\DependencyInjection\Compiler;
4
5
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
8
class ApiUrlPass implements CompilerPassInterface
9
{
10
    public function process(ContainerBuilder $container)
11
    {
12
        $url = $container->getParameter('friendly.api.base_url');
13
14
        if (empty($url)) {
15
            if ($container->hasParameter('mink.base_url')) {
16
                $url = $container->getParameter('mink.base_url');
17
            }
18
        }
19
20
        $container->setParameter('friendly.api.base_url', $url);
21
    }
22
}
23