WBWJQueryQueryBuilderExtension   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getAlias() 0 3 1
A load() 0 18 1
1
<?php
2
3
/*
4
 * This file is part of the jquery-querybuilder-bundle package.
5
 *
6
 * (c) 2017 WEBEWEB
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace WBW\Bundle\JQuery\QueryBuilderBundle\DependencyInjection;
13
14
use Symfony\Component\Config\Definition\ConfigurationInterface;
15
use Symfony\Component\Config\FileLocator;
16
use Symfony\Component\DependencyInjection\ContainerBuilder;
17
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
18
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
19
use WBW\Bundle\CoreBundle\DependencyInjection\ConfigurationHelper;
20
21
/**
22
 * jQuery QueryBuilder extension.
23
 *
24
 * @author webeweb <https://github.com/webeweb/>
25
 * @package WBW\Bundle\JQuery\QueryBuilderBundle\DependencyInjection
26
 */
27
class WBWJQueryQueryBuilderExtension extends Extension {
28
29
    /**
30
     * Extension alias.
31
     *
32
     * @var string
33
     */
34
    const EXTENSION_ALIAS = "wbw_jquery_querybuilder";
35
36
    /**
37
     * {@inheritDoc}
38
     */
39
    public function getAlias(): string {
40
        return self::EXTENSION_ALIAS;
41
    }
42
43
    /**
44
     * {@inheritdoc}
45
     */
46
    public function load(array $configs, ContainerBuilder $container): void {
47
48
        $fileLocator = new FileLocator(__DIR__ . "/../Resources/config");
49
50
        $serviceLoader = new YamlFileLoader($container, $fileLocator);
51
        $serviceLoader->load("services.yml");
52
53
        /** @var ConfigurationInterface $configuration */
54
        $configuration = $this->getConfiguration($configs, $container);
55
56
        $config = $this->processConfiguration($configuration, $configs);
57
58
        ConfigurationHelper::registerContainerParameter($container, $config, $this->getAlias(), "locale");
59
        ConfigurationHelper::registerContainerParameter($container, $config, $this->getAlias(), "theme");
60
61
        $assets = ConfigurationHelper::loadYamlConfig(__DIR__, "assets");
62
        ConfigurationHelper::registerContainerParameters($container, $assets["assets"]);
63
    }
64
}
65