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

PignusExtension   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 4
dl 0
loc 16
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A loadInternal() 0 10 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