ApiUrlPass   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 6
c 1
b 0
f 0
dl 0
loc 13
rs 10

1 Method

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