SymballReportExtension   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 7

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 7
dl 0
loc 25
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A load() 0 19 1
1
<?php
2
3
/*
4
 * This file is part of the ReportBundle package
5
 * 
6
 * (c) symball <http://simonball.me>
7
 * 
8
 * For the full copyright and license information, please view the LICENSE file 
9
 * that was distributed with this source code.
10
 */
11
12
namespace Symball\ReportBundle\DependencyInjection;
13
14
use Symfony\Component\DependencyInjection\ContainerBuilder;
15
use Symfony\Component\Config\FileLocator;
16
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
17
use Symfony\Component\DependencyInjection\Loader;
18
use Symfony\Component\DependencyInjection\Reference;
19
20
class SymballReportExtension extends Extension
21
{
22
    /**
23
     * {@inheritdoc}
24
     */
25
    public function load(array $configs, ContainerBuilder $container)
26
    {
27
        $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
28
        $loader->load('services.yml');
29
30
        $configuration = new Configuration();
31
        $config = $this->processConfiguration($configuration, $configs);
32
33
        $definition = $container->getDefinition('symball_report.excel_service');
34
        $definition->replaceArgument(0, $config['default_report_path']);
35
        $definition->replaceArgument(1, $config['excel_factory_namespace']);
36
        $definition->replaceArgument(2, $config['output_format']);
37
38
        $builderDefinition = $container->getDefinition('symball_report.report_builder');
39
        $builderDefinition->replaceArgument(0, new Reference('symball_report.excel_service'));
40
41
        $navServiceName = 'symball_report.navigation.' . $config['layout_style'];
42
        $builderDefinition->replaceArgument(2, new Reference($navServiceName));
43
    }
44
}
45