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

MigrationFileListerPass::process()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 18
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 4
eloc 10
nc 4
nop 1
dl 0
loc 18
rs 9.2
c 0
b 0
f 0
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