Completed
Push — master ( 3e31ed...54e145 )
by Artem
03:34
created

PignusExtension   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
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 17
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A loadInternal() 0 11 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 5
        $loader->load('services.yml');
33
34 5
        if ($mergedConfig['unauthorized_request']) {
35 1
            $loader->load('unauthorized_request.yml');
36
        }
37
38 5
        $container->setParameter('pignus.login', $mergedConfig['login'] ?? []);
39 5
    }
40
}
41