Completed
Push — ezp25946-migrate_files_to_othe... ( e1d3cb...7924de )
by
unknown
12:27
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
 * File containing the MigrationFileListerPass class.
5
 *
6
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
7
 * @license For full copyright and license information view LICENSE file distributed with this source code.
8
 */
9
namespace eZ\Bundle\EzPublishIOBundle\DependencyInjection\Compiler;
10
11
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
12
use Symfony\Component\DependencyInjection\ContainerBuilder;
13
use Symfony\Component\DependencyInjection\Reference;
14
15
class MigrationFileListerPass implements CompilerPassInterface
16
{
17
    /**
18
     * Registers the FileListerInterface into the file lister registry.
19
     *
20
     * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
21
     */
22
    public function process(ContainerBuilder $container)
23
    {
24
        if (!$container->has('ezpublish.core.io.migration.file_lister_registry')) {
25
            return;
26
        }
27
28
        $fileListersTagged = $container->findTaggedServiceIds('ezpublish.core.io.migration.file_lister');
29
30
        $fileListers = [];
31
        foreach ($fileListersTagged as $id => $tags) {
32
            foreach ($tags as $attributes) {
33
                $fileListers[$attributes['identifier']] = new Reference($id);
34
            }
35
        }
36
37
        $fileListerRegistryDef = $container->findDefinition('ezpublish.core.io.migration.file_lister_registry');
38
        $fileListerRegistryDef->setArguments([$fileListers]);
39
    }
40
}
41