Code Duplication    Length = 24-29 lines in 6 locations

Bundle/BusinessPageBundle/DependencyInjection/Compiler/BusinessTemplateCompilerPass.php 1 location

@@ 12-35 (lines=24) @@
9
/**
10
 * Class BusinessTemplateCompilerPass.
11
 */
12
class BusinessTemplateCompilerPass implements CompilerPassInterface
13
{
14
    public function process(ContainerBuilder $container)
15
    {
16
        if (!$container->hasDefinition('victoire_business_page.BusinessTemplate_chain')) {
17
            return;
18
        }
19
        $chainDefinition = $container->getDefinition(
20
            'victoire_business_page.BusinessTemplate_chain'
21
        );
22
        $taggedServices = $container->findTaggedServiceIds(
23
            'victoire_core.bussinessEntityPagePattern'
24
        );
25
26
        foreach ($taggedServices as $id => $tagAttributes) {
27
            foreach ($tagAttributes as $attributes) {
28
                $chainDefinition->addMethodCall(
29
                    'addBusinessTemplate',
30
                    [new Reference($id), $attributes['alias']]
31
                );
32
            }
33
        }
34
    }
35
}
36

Bundle/WidgetBundle/DependencyInjection/Compiler/WidgetContentResolverPass.php 1 location

@@ 9-37 (lines=29) @@
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
use Symfony\Component\DependencyInjection\Reference;
8
9
class WidgetContentResolverPass implements CompilerPassInterface
10
{
11
    /**
12
     * Process filter.
13
     *
14
     * @param ContainerBuilder $container
15
     */
16
    public function process(ContainerBuilder $container)
17
    {
18
        if ($container->hasDefinition('victoire_widget.widget_content_resolver_chain')) {
19
            $definition = $container->getDefinition(
20
                'victoire_widget.widget_content_resolver_chain'
21
            );
22
23
            $taggedServices = $container->findTaggedServiceIds(
24
                'victoire_widget.widget_content_resolver'
25
            );
26
27
            foreach ($taggedServices as $id => $attributes) {
28
                foreach ($attributes as $attribute) {
29
                    $definition->addMethodCall(
30
                        'addResolver',
31
                        [$attribute['alias'], new Reference($id)]
32
                    );
33
                }
34
            }
35
        }
36
    }
37
}
38

Bundle/WidgetBundle/DependencyInjection/Compiler/WidgetItemPass.php 1 location

@@ 9-36 (lines=28) @@
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
use Symfony\Component\DependencyInjection\Reference;
8
9
class WidgetItemPass implements CompilerPassInterface
10
{
11
    /**
12
     * Process filter.
13
     *
14
     * @param ContainerBuilder $container
15
     */
16
    public function process(ContainerBuilder $container)
17
    {
18
        if ($container->hasDefinition('victoire_widget.widget_item_content_resolver_chain')) {
19
            $definition = $container->getDefinition(
20
                'victoire_widget.widget_item_content_resolver_chain'
21
            );
22
23
            $taggedServices = $container->findTaggedServiceIds(
24
                'victoire_widget.widget_item'
25
            );
26
27
            foreach ($taggedServices as $id => $attributes) {
28
                foreach ($attributes as $attribute) {
29
                    $definition->addMethodCall(
30
                        'addWidgetItem', [new Reference($id)]
31
                    );
32
                }
33
            }
34
        }
35
    }
36
}
37

Bundle/CriteriaBundle/DependencyInjection/Compiler/DataSourceCompilerPass.php 1 location

@@ 9-35 (lines=27) @@
6
use Symfony\Component\DependencyInjection\ContainerBuilder;
7
use Symfony\Component\DependencyInjection\Reference;
8
9
class DataSourceCompilerPass implements CompilerPassInterface
10
{
11
    /**
12
     * @param ContainerBuilder $container
13
     */
14
    public function process(ContainerBuilder $container)
15
    {
16
        if (!$container->hasDefinition('victoire_criteria.chain.data_source_chain')) {
17
            return;
18
        }
19
        $chainDefinition = $container->getDefinition(
20
            'victoire_criteria.chain.data_source_chain'
21
        );
22
        $taggedServices = $container->findTaggedServiceIds(
23
            'victoire_criteria'
24
        );
25
        foreach ($taggedServices as $id => $tagAttributes) {
26
            foreach ($tagAttributes as $attributes) {
27
                $chainDefinition->addMethodCall(
28
                    'addDataSource',
29
                    [new Reference($id), $attributes]
30
                );
31
            }
32
        }
33
    }
34
}
35

Bundle/APIBusinessEntityBundle/DependencyInjection/Compiler/APIAuthenticationCompilerPass.php 1 location

@@ 12-35 (lines=24) @@
9
/**
10
 * Class APIAuthenticationCompilerPass.
11
 */
12
class APIAuthenticationCompilerPass implements CompilerPassInterface
13
{
14
    /**
15
     * {@inheritdoc}
16
     */
17
    public function process(ContainerBuilder $container)
18
    {
19
        $chainDefinition = $container->getDefinition(
20
            'victoire_api_business_entity.chain.api_authentication_chain'
21
        );
22
        $taggedServices = $container->findTaggedServiceIds(
23
            'victoire_api_business_entity.api_authentication'
24
        );
25
26
        foreach ($taggedServices as $id => $tagAttributes) {
27
            foreach ($tagAttributes as $attributes) {
28
                $chainDefinition->addMethodCall(
29
                    'addAuthenticationMethod',
30
                    [new Reference($id)]
31
                );
32
            }
33
        }
34
    }
35
}
36

Bundle/BusinessEntityBundle/DependencyInjection/Compiler/BusinessEntityResolverCompilerPass.php 1 location

@@ 15-38 (lines=24) @@
12
 *
13
 * @author Paul Andrieux
14
 **/
15
class BusinessEntityResolverCompilerPass implements CompilerPassInterface
16
{
17
    public function process(ContainerBuilder $container)
18
    {
19
        if (!$container->hasDefinition('victoire_business_entity.resolver.business_entity_resolver')) {
20
            return;
21
        }
22
        $chainDefinition = $container->getDefinition(
23
            'victoire_business_entity.resolver.business_entity_resolver'
24
        );
25
        $taggedServices = $container->findTaggedServiceIds(
26
            'victoire_business_entity.resolver'
27
        );
28
29
        foreach ($taggedServices as $id => $tagAttributes) {
30
            foreach ($tagAttributes as $attributes) {
31
                $chainDefinition->addMethodCall(
32
                    'addResolver',
33
                    [new Reference($id), $attributes['type']]
34
                );
35
            }
36
        }
37
    }
38
}
39