ArtprimaPrometheusMetricsExtension::load()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 14
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 10
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 14
ccs 10
cts 10
cp 1
rs 9.9666
cc 2
nc 2
nop 2
crap 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