Completed
Push — 6.7 ( caaa8b...485307 )
by
unknown
19:19
created

MigrationFileListerPass   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 26
rs 10
c 0
b 0
f 0
wmc 4
lcom 0
cbo 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 18 4
1
<?php
2
3
/**
4
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
5
 * @license For full copyright and license information view LICENSE file distributed with this source code.
6
 */
7
namespace eZ\Bundle\EzPublishIOBundle\DependencyInjection\Compiler;
8
9
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
10
use Symfony\Component\DependencyInjection\ContainerBuilder;
11
use Symfony\Component\DependencyInjection\Reference;
12
13
final class MigrationFileListerPass implements CompilerPassInterface
14
{
15
    /**
16
     * Registers the FileListerInterface into the file lister registry.
17
     *
18
     * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
19
     */
20
    public function process(ContainerBuilder $container)
21
    {
22
        if (!$container->has('ezpublish.core.io.migration.file_lister_registry')) {
23
            return;
24
        }
25
26
        $fileListersTagged = $container->findTaggedServiceIds('ezpublish.core.io.migration.file_lister');
27
28
        $fileListers = [];
29
        foreach ($fileListersTagged as $id => $tags) {
30
            foreach ($tags as $attributes) {
31
                $fileListers[$attributes['identifier']] = new Reference($id);
32
            }
33
        }
34
35
        $fileListerRegistryDef = $container->findDefinition('ezpublish.core.io.migration.file_lister_registry');
36
        $fileListerRegistryDef->setArguments([$fileListers]);
37
    }
38
}
39