QueryFilterExtension::load()   A
last analyzed

Complexity

Conditions 3
Paths 2

Size

Total Lines 21
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 12
c 1
b 0
f 0
nc 2
nop 2
dl 0
loc 21
rs 9.8666
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Bugloos\QueryFilterBundle\DependencyInjection;
6
7
use http\Exception\RuntimeException;
8
use Symfony\Component\Config\FileLocator;
9
use Symfony\Component\DependencyInjection\ContainerBuilder;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Depend...ection\ContainerBuilder was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Depend...on\Loader\XmlFileLoader was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
12
13
/**
14
 * @author Milad Ghofrani <[email protected]>
15
 */
16
class QueryFilterExtension extends Extension
17
{
18
    public function load(array $configs, ContainerBuilder $container)
19
    {
20
        $configuration = $this->getConfiguration($configs, $container);
21
22
        if (!isset($configuration) || empty($configuration)) {
23
            throw new RuntimeException(
24
                'The configuration is not set correctly'
25
            );
26
        }
27
28
        $config = $this->processConfiguration($configuration, $configs);
29
30
        $loader = new XmlFileLoader(
31
            $container,
32
            new FileLocator(__DIR__.'/../Resources/config')
33
        );
34
        $loader->load('services.xml');
35
36
        $definition = $container->getDefinition('bugloos_query_filter.query_filter');
37
        $definition->setArgument(3, $config['default_cache_time']);
38
        $definition->setArgument(4, $config['separator']);
39
    }
40
}
41