ApplicationCommandsPass   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

Changes 1
Bugs 1 Features 0
Metric Value
wmc 2
c 1
b 1
f 0
lcom 0
cbo 5
dl 0
loc 17
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 11 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\Command\OverwriteFileCommandBuilder;
16
use BenGorFile\FileBundle\DependencyInjection\Compiler\Application\Command\RemoveFileCommandBuilder;
17
use BenGorFile\FileBundle\DependencyInjection\Compiler\Application\Command\RenameFileCommandBuilder;
18
use BenGorFile\FileBundle\DependencyInjection\Compiler\Application\Command\SuffixNumberFileCommandBuilder;
19
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
20
use Symfony\Component\DependencyInjection\ContainerBuilder;
21
22
/**
23
 * Register application commands compiler pass.
24
 *
25
 * Command declaration via PHP allows more
26
 * flexibility with customization extend files.
27
 *
28
 * @author Beñat Espiña <[email protected]>
29
 */
30
class ApplicationCommandsPass implements CompilerPassInterface
31
{
32
    /**
33
     * {@inheritdoc}
34
     */
35
    public function process(ContainerBuilder $container)
36
    {
37
        $config = $container->getParameter('bengor_file.config');
38
39
        foreach ($config['file_class'] as $key => $file) {
40
            (new SuffixNumberFileCommandBuilder($container, $file['persistence'], $file))->build($key);
41
            (new OverwriteFileCommandBuilder($container, $file['persistence']))->build($key);
42
            (new RenameFileCommandBuilder($container, $file['persistence']))->build($key);
43
            (new RemoveFileCommandBuilder($container, $file['persistence']))->build($key);
44
        }
45
    }
46
}
47