Code Duplication    Length = 28-29 lines in 3 locations

DependencyInjection/Compiler/ReportPatternPass.php 1 location

@@ 22-50 (lines=29) @@
19
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
20
use Symfony\Component\DependencyInjection\Reference;
21
22
class ReportPatternPass implements CompilerPassInterface
23
{
24
    /**
25
     * {@inheritdoc}
26
     */
27
    public function process(ContainerBuilder $container)
28
    {
29
        
30
        // always first check if the primary service is defined
31
        if (!$container->has('symball_report.pattern')) {
32
            return;
33
        }
34
        
35
        $definition = $container->findDefinition('symball_report.pattern');
36
        
37
        // find all service IDs with the app.mail_transport tag
38
        $taggedServices = $container->findTaggedServiceIds('symball_report.pattern');
39
40
        foreach ($taggedServices as $id => $tags) {
41
            foreach ($tags as $attributes) {
42
                // add the transport service to the ChainTransport service
43
                $definition->addMethodCall('addPattern', array(
44
                    new Reference($id),
45
                    $attributes["alias"],
46
                ));
47
            }
48
        }
49
    }
50
}
51

DependencyInjection/Compiler/ReportStylePass.php 1 location

@@ 23-50 (lines=28) @@
20
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
21
use Symfony\Component\DependencyInjection\Reference;
22
23
class ReportStylePass implements CompilerPassInterface
24
{
25
    /**
26
     * {@inheritdoc}
27
     */
28
    public function process(ContainerBuilder $container)
29
    {
30
        // always first check if the primary service is defined
31
        if (!$container->has('symball_report.style')) {
32
            return;
33
        }
34
35
        $definition = $container->findDefinition('symball_report.style');
36
37
        // find all service IDs with the app.mail_transport tag
38
        $taggedServices = $container->findTaggedServiceIds('symball_report.style');
39
40
        foreach ($taggedServices as $id => $tags) {
41
            foreach ($tags as $attributes) {
42
                // add the transport service to the ChainTransport service
43
                $definition->addMethodCall('addStyle', array(
44
                    new Reference($id),
45
                    $attributes["alias"],
46
                ));
47
            }
48
        }
49
    }
50
}
51

DependencyInjection/Compiler/ReportQueryPass.php 1 location

@@ 22-50 (lines=29) @@
19
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
20
use Symfony\Component\DependencyInjection\Reference;
21
22
class ReportQueryPass implements CompilerPassInterface
23
{
24
    /**
25
     * {@inheritdoc}
26
     */
27
    public function process(ContainerBuilder $container)
28
    {
29
        
30
        // always first check if the primary service is defined
31
        if (!$container->has('symball_report.query')) {
32
            return;
33
        }
34
        
35
        $definition = $container->findDefinition('symball_report.query');
36
        
37
        // find all service IDs with the app.mail_transport tag
38
        $taggedServices = $container->findTaggedServiceIds('symball_report.query');
39
40
        foreach ($taggedServices as $id => $tags) {
41
            foreach ($tags as $attributes) {
42
                // add the transport service to the ChainTransport service
43
                $definition->addMethodCall('addQuery', array(
44
                    new Reference($id),
45
                    $attributes["alias"],
46
                ));
47
            }
48
        }
49
    }
50
}
51