ApplicationQueriesPass   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 6
dl 0
loc 18
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 12 2
1
<?php
2
3
/*
4
 * This file is part of the BenGorFile 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 BenGorFile\FileBundle\DependencyInjection\Compiler;
14
15
use BenGorFile\FileBundle\DependencyInjection\Compiler\Application\Query\CountFilesQueryBuilder;
16
use BenGorFile\FileBundle\DependencyInjection\Compiler\Application\Query\FileOfIdQueryBuilder;
17
use BenGorFile\FileBundle\DependencyInjection\Compiler\Application\Query\FileOfNameQueryBuilder;
18
use BenGorFile\FileBundle\DependencyInjection\Compiler\Application\Query\FilterFilesQueryBuilder;
19
use BenGorFile\FileBundle\DependencyInjection\Compiler\Application\Query\ListFilesOfIdsQueryBuilder;
20
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
21
use Symfony\Component\DependencyInjection\ContainerBuilder;
22
23
/**
24
 * Register application queries compiler pass.
25
 *
26
 * Query declaration via PHP allows more
27
 * flexibility with customization extend files.
28
 *
29
 * @author Beñat Espiña <[email protected]>
30
 */
31
class ApplicationQueriesPass implements CompilerPassInterface
32
{
33
    /**
34
     * {@inheritdoc}
35
     */
36
    public function process(ContainerBuilder $container)
37
    {
38
        $config = $container->getParameter('bengor_file.config');
39
40
        foreach ($config['file_class'] as $key => $file) {
41
            (new CountFilesQueryBuilder($container))->build($key);
42
            (new FilterFilesQueryBuilder($container))->build($key);
43
            (new FileOfIdQueryBuilder($container))->build($key);
44
            (new FileOfNameQueryBuilder($container))->build($key);
45
            (new ListFilesOfIdsQueryBuilder($container))->build($key);
46
        }
47
    }
48
}
49