Completed
Push — master ( f306e2...1c3e11 )
by Joachim
11:02
created

LoevgaardDandomainStockExtension   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Test Coverage

Coverage 50%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 5
dl 0
loc 35
ccs 7
cts 14
cp 0.5
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A load() 0 10 1
A prepend() 0 21 3
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Loevgaard\DandomainStockBundle\DependencyInjection;
6
7
use Symfony\Component\Config\FileLocator;
8
use Symfony\Component\DependencyInjection\ContainerBuilder;
9
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
10
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
11
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
12
13
class LoevgaardDandomainStockExtension extends Extension implements PrependExtensionInterface
14
{
15 2
    public function load(array $configs, ContainerBuilder $container)
16
    {
17 2
        $configuration = new Configuration();
18 2
        $config = $this->processConfiguration($configuration, $configs);
19
20 1
        $container->setParameter('loevgaard_dandomain_stock.dandomain_order_state_ids', $config['dandomain_order_state_ids']);
21
22 1
        $loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
23 1
        $loader->load('services.yml');
24 1
    }
25
26
    public function prepend(ContainerBuilder $container)
27
    {
28
        foreach ($container->getExtensions() as $name => $extension) {
29
            if ('doctrine' !== $name) {
0 ignored issues
show
Unused Code Bug introduced by
The strict comparison !== seems to always evaluate to true as the types of 'doctrine' (string) and $name (integer) can never be identical. Maybe you want to use a loose comparison != instead?
Loading history...
30
                continue;
31
            }
32
33
            $container->prependExtensionConfig($name, [
34
                'orm' => [
35
                    'mappings' => [
36
                        'Loevgaard\\DandomainStock\\Entity' => [
37
                            'type' => 'annotation',
38
                            'dir' => '%kernel.project_dir%/vendor/loevgaard/dandomain-stock-entities/src/Entity',
39
                            'is_bundle' => false,
40
                            'prefix' => 'Loevgaard\\DandomainStock\\Entity',
41
                        ],
42
                    ],
43
                ],
44
            ]);
45
        }
46
    }
47
}
48