Completed
Push — issue#804 ( c079af...030c84 )
by Guilherme
04:41
created

PROCERGSCpfVerificationExtension   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 24
ccs 12
cts 12
cp 1
rs 10
c 0
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A load() 0 18 3
1
<?php
2
3
namespace PROCERGS\LoginCidadao\CpfVerificationBundle\DependencyInjection;
4
5
use Symfony\Component\DependencyInjection\ContainerBuilder;
6
use Symfony\Component\Config\FileLocator;
7
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
8
use Symfony\Component\DependencyInjection\Loader;
9
10
/**
11
 * This is the class that loads and manages your bundle configuration
12
 *
13
 * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
14
 */
15
class PROCERGSCpfVerificationExtension extends Extension
16
{
17
    /**
18
     * {@inheritdoc}
19
     * @throws \Exception
20
     */
21 1
    public function load(array $configs, ContainerBuilder $container)
22
    {
23 1
        $configuration = new Configuration();
24 1
        $config = $this->processConfiguration($configuration, $configs);
25
26 1
        $container->setParameter('procergs.nfg.cpf_verification.base_uri', $config['base_uri']);
27
28 1
        $endpoints = [];
29 1
        if (isset($config['list_challenges_path'])) {
30 1
            $endpoints['listChallenges'] = $config['list_challenges_path'];
31
        }
32 1
        if (isset($config['challenge_path'])) {
33 1
            $endpoints['challenge'] = $config['challenge_path'];
34
        }
35 1
        $container->setParameter('procergs.nfg.cpf_verification.options.endpoints', $endpoints);
36
37 1
        $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
38 1
        $loader->load('services.yml');
39 1
    }
40
}
41