GoetasApacheFopExtension   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 33
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A load() 0 9 1
A createServices() 0 17 3
1
<?php
2
3
namespace Goetas\ApacheFopBundle\DependencyInjection;
4
5
use Symfony\Component\DependencyInjection\Definition;
6
7
use Symfony\Component\DependencyInjection\ContainerBuilder;
8
use Symfony\Component\Config\FileLocator;
9
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
10
use Symfony\Component\DependencyInjection\Loader;
11
12
class GoetasApacheFopExtension extends Extension
13
{
14
    /**
15
     * {@inheritDoc}
16
     */
17
    public function load(array $configs, ContainerBuilder $container)
18
    {
19
        $configuration = new Configuration ();
20
        $config = $this->processConfiguration ( $configuration, $configs );
21
22
        $loader = new Loader\XmlFileLoader ( $container, new FileLocator ( __DIR__ . '/../Resources/config' ) );
23
        $loader->load ( 'services.xml' );
24
        $this->createServices ( $config, $container );
25
    }
26
    protected function createServices($config, ContainerBuilder $container)
27
    {
28
        $definition = new Definition ( '%goetas.fop.processor.class%' );
29
30
        $definition->setArguments ( array ($config ['executable'] ) );
31
32
        if ($config["config"]!==null) {
33
            $definition->addMethodCall("setConfigurationFile", array($config["config"]));
34
        }
35
36
        if ($config["java"]!==null) {
37
            $definition->addMethodCall("setJavaExecutable", array($config["config"]));
38
        }
39
40
        $definition->setPublic ( true );
41
        $container->setDefinition("goetas.fop", $definition);
42
    }
43
44
}
45