Completed
Push — master ( 7d9afb...4e0ac6 )
by Łukasz
49:46 queued 21:48
created

NotificationRendererPass   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A process() 0 14 4
1
<?php
2
/**
3
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
4
 * @license For full copyright and license information view LICENSE file distributed with this source code.
5
 */
6
declare(strict_types=1);
7
8
namespace eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Compiler;
9
10
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
11
use Symfony\Component\DependencyInjection\ContainerBuilder;
12
use Symfony\Component\DependencyInjection\Reference;
13
14
/**
15
 * Adds all available export methods to registry.
16
 */
17
class NotificationRendererPass implements CompilerPassInterface
18
{
19
    /**
20
     * @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
21
     */
22
    public function process(ContainerBuilder $container)
23
    {
24
        if (!$container->has('notification.renderer.registry')) {
25
            return;
26
        }
27
28
        $registry = $container->findDefinition('notification.renderer.registry');
29
30
        foreach ($container->findTaggedServiceIds('ezstudio.notification.renderer') as $id => $tags) {
31
            foreach ($tags as $tag) {
32
                $registry->addMethodCall('addRenderer', [$tag['alias'], new Reference($id)]);
33
            }
34
        }
35
    }
36
}
37