ArtprimaPrometheusMetricsExtension   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 10
c 1
b 0
f 0
dl 0
loc 19
ccs 10
cts 10
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A load() 0 14 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Artprima\PrometheusMetricsBundle\DependencyInjection;
6
7
use Symfony\Component\Config\FileLocator;
8
use Symfony\Component\DependencyInjection\ContainerBuilder;
9
use Symfony\Component\DependencyInjection\Loader;
10
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
11
12
/**
13
 * This is the class that loads and manages the bundle configuration.
14
 *
15
 * @see http://symfony.com/doc/current/cookbook/bundles/extension.html
16
 */
17
class ArtprimaPrometheusMetricsExtension extends Extension
18
{
19
    /**
20
     * {@inheritdoc}
21
     */
22 6
    public function load(array $configs, ContainerBuilder $container)
23
    {
24 6
        $configuration = new Configuration();
25 6
        $config = $this->processConfiguration($configuration, $configs);
26
27 6
        $container->setParameter('prometheus_metrics_bundle.namespace', $config['namespace']);
28 6
        $container->setParameter('prometheus_metrics_bundle.type', $config['type']);
29 6
        if ('redis' === $config['type']) {
30 3
            $container->setParameter('prometheus_metrics_bundle.redis', $config['redis']);
31
        }
32 6
        $container->setParameter('prometheus_metrics_bundle.ignored_routes', $config['ignored_routes']);
33
34 6
        $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
35 6
        $loader->load('services.xml');
36 6
    }
37
}
38