ApplicationDataTransformersPass::process()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 6
nc 2
nop 1
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\DataTransformer\FileDTODataTransformerBuilder;
16
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
17
use Symfony\Component\DependencyInjection\ContainerBuilder;
18
19
/**
20
 * Register application data transformers compiler pass.
21
 *
22
 * Data transformer declaration via PHP allows more
23
 * flexibility with customization extend files.
24
 *
25
 * @author Beñat Espiña <[email protected]>
26
 */
27
class ApplicationDataTransformersPass implements CompilerPassInterface
28
{
29
    /**
30
     * {@inheritdoc}
31
     */
32
    public function process(ContainerBuilder $container)
33
    {
34
        $config = $container->getParameter('bengor_file.config');
35
36
        foreach ($config['file_class'] as $key => $file) {
37
            (new FileDTODataTransformerBuilder(
38
                $container, $file['data_transformer']
39
            ))->build($key);
40
        }
41
    }
42
}
43