Completed
Pull Request — master (#4264)
by Craig
06:11
created

InstallerPass::process()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 3
eloc 6
nc 3
nop 1
dl 0
loc 10
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Zikula package.
7
 *
8
 * Copyright Zikula - https://ziku.la/
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Zikula\ExtensionsModule\DependencyInjection\Compiler;
15
16
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
17
use Symfony\Component\DependencyInjection\ContainerBuilder;
18
use Symfony\Component\DependencyInjection\Reference;
19
use Zikula\ExtensionsModule\Collector\InstallerCollector;
20
21
class InstallerPass implements CompilerPassInterface
22
{
23
    public function process(ContainerBuilder $container)
24
    {
25
        if (!$container->hasDefinition(InstallerCollector::class)) {
26
            return;
27
        }
28
29
        $definition = $container->findDefinition(InstallerCollector::class);
30
        $taggedServices = $container->findTaggedServiceIds('zikula.extension_installer');
31
        foreach ($taggedServices as $id => $tags) {
32
            $definition->addMethodCall('add', [new Reference($id)]);
33
        }
34
    }
35
}
36