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

PROCERGSCpfVerificationExtension::load()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 18
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 12
CRAP Score 3

Importance

Changes 0
Metric Value
cc 3
eloc 11
nc 4
nop 2
dl 0
loc 18
ccs 12
cts 12
cp 1
crap 3
rs 9.9
c 0
b 0
f 0
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