SimpleBusDoctrineODMMongoDBBridgeExtension::load()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 6
Ratio 100 %

Importance

Changes 0
Metric Value
dl 6
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
3
/*
4
 * This file is part of the BenGorUser package.
5
 *
6
 * (c) Beñat Espiña <[email protected]>
7
 * (c) Gorka Laucirica <[email protected]>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
namespace BenGorUser\SimpleBusBridgeBundle\DependencyInjection;
14
15
use BenGorUser\UserBundle\DependencyInjection\Configuration;
16
use Symfony\Component\Config\FileLocator;
17
use Symfony\Component\DependencyInjection\ContainerBuilder;
18
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
19
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
20
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
21
22
/**
23
 * Simple bus and Doctrine ODM MongoDB bridge bundle extension class.
24
 *
25
 * @author Beñat Espiña <[email protected]>
26
 */
27 View Code Duplication
class SimpleBusDoctrineODMMongoDBBridgeExtension extends Extension implements PrependExtensionInterface, SimpleBusTaggerExtension
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 129 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
28
{
29
    /**
30
     * {@inheritdoc}
31
     */
32
    public function load(array $configs, ContainerBuilder $container)
33
    {
34
        $loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
35
36
        $loader->load('doctrine_odm_mongodb.yml');
37
    }
38
39
    /**
40
     * {@inheritdoc}
41
     */
42
    public function prepend(ContainerBuilder $container)
43
    {
44
        $configuration = new Configuration();
45
        $configs = $container->getExtensionConfig('ben_gor_user');
46
        $config = $this->processConfiguration($configuration, $configs);
47
48
        $container->setParameter('bengor_user.config', $config);
49
    }
50
51
    /**
52
     * {@inheritdoc}
53
     */
54
    public function addMiddlewareTags(ContainerBuilder $container, $user)
55
    {
56
        $container->getDefinition(
57
            'bengor_user.simple_bus_bridge_bundle.doctrine_odm_mongodb_transactional_middleware'
58
        )->addTag(
59
            'bengor_user_' . $user . '_command_bus_middleware', ['priority' => '0']
60
        );
61
62
        return $container;
63
    }
64
}
65