GearmanExtension   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 5
dl 0
loc 61
ccs 28
cts 28
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A load() 0 48 1
1
<?php
2
3
/**
4
 * Gearman Bundle for Symfony2 / Symfony3
5
 *
6
 * For the full copyright and license information, please view the LICENSE
7
 * file that was distributed with this source code.
8
 *
9
 * Feel free to edit as you please, and have fun.
10
 *
11
 * @author Marc Morera <[email protected]>
12
 */
13
14
namespace Mkk\GearmanBundle\DependencyInjection;
15
16
use Symfony\Component\Config\FileLocator;
17
use Symfony\Component\DependencyInjection\ContainerBuilder;
18
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
19
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
20
21
/**
22
 * This is the class that loads and manages your bundle configuration
23
 */
24
class GearmanExtension extends Extension
25
{
26
    /**
27
     * Loads a specific configuration.
28
     *
29
     * @param array            $config    An array of configuration values
30
     * @param ContainerBuilder $container A ContainerBuilder instance
31
     *
32
     * @throws \InvalidArgumentException When provided tag is not defined in this extension
33
     *
34
     * @api
35
     */
36 1
    public function load(array $config, ContainerBuilder $container)
37
    {
38 1
        $configuration = new Configuration();
39 1
        $config = $this->processConfiguration($configuration, $config);
0 ignored issues
show
Coding Style introduced by
Consider using a different name than the parameter $config. This often makes code more readable.
Loading history...
40
41
        /**
42
         * Setting all config elements as DI parameters to inject them
43
         */
44 1
        $container->setParameter(
45 1
            'gearman.bundles',
46 1
            $config['bundles']
47
        );
48
49 1
        $container->setParameter(
50 1
            'gearman.resources',
51 1
            $config['resources']
52
        );
53
54 1
        $container->setParameter(
55 1
            'gearman.servers',
56 1
            $config['servers']
57
        );
58
59 1
        $container->setParameter(
60 1
            'gearman.default.settings',
61 1
            $config['defaults']
62
        );
63
64 1
        $container->setParameter(
65 1
            'gearman.default.settings.generate_unique_key',
66 1
            $config['defaults']['generate_unique_key']
67
        );
68
69 1
        $loader = new YamlFileLoader(
70 1
            $container,
71 1
            new FileLocator(__DIR__ . '/../Resources/config')
72
        );
73
74
        /**
75
         * Loading DI definitions
76
         */
77 1
        $loader->load('classes.yml');
78 1
        $loader->load('services.yml');
79 1
        $loader->load('commands.yml');
80 1
        $loader->load('eventDispatchers.yml');
81 1
        $loader->load('generators.yml');
82 1
        $loader->load('externals.yml');
83 1
    }
84
}
85