Completed
Push — master ( e111ee...b6ca56 )
by Artem
04:57
created

PignusExtension::loadInternal()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 10
ccs 6
cts 6
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 5
nc 2
nop 2
crap 2
1
<?php
2
3
//----------------------------------------------------------------------
4
//
5
//  Copyright (C) 2017 Artem Rodygin
6
//
7
//  You should have received a copy of the MIT License along with
8
//  this file. If not, see <http://opensource.org/licenses/MIT>.
9
//
10
//----------------------------------------------------------------------
11
12
namespace Pignus\DependencyInjection;
13
14
use Symfony\Component\Config\FileLocator;
15
use Symfony\Component\DependencyInjection\ContainerBuilder;
16
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
17
use Symfony\Component\HttpKernel\DependencyInjection\ConfigurableExtension;
18
19
/**
20
 * Loads and manages the bundle configuration.
21
 *
22
 * @see http://symfony.com/doc/current/cookbook/bundles/extension.html
23
 */
24
class PignusExtension extends ConfigurableExtension
25
{
26
    /**
27
     * {@inheritdoc}
28
     */
29 5
    protected function loadInternal(array $mergedConfig, ContainerBuilder $container)
30
    {
31 5
        $loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
32
33 5
        if ($mergedConfig['unauthorized_request']) {
34 1
            $loader->load('unauthorized_request.yml');
35
        }
36
37 5
        $container->setParameter('pignus.login', $mergedConfig['login'] ?? []);
38 5
    }
39
}
40