Code Duplication    Length = 17-17 lines in 3 locations

src/DependencyInjection/Compiler/DocumentHydratorCompilerPass.php 1 location

@@ 10-26 (lines=17) @@
7
use Symfony\Component\DependencyInjection\ContainerBuilder;
8
use Symfony\Component\DependencyInjection\Reference;
9
10
class DocumentHydratorCompilerPass implements CompilerPassInterface
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15
    public function process(ContainerBuilder $container)
16
    {
17
        $definition = $container->findDefinition('mrtn_json_api.document_hydrator');
18
        $extensions = $container->findTaggedServiceIds('mrtn_json_api.document_hydrator.extension');
19
20
        foreach ($extensions as $id => $tags) {
21
            $definition->addMethodCall('registerExtension', [
22
                new Reference($id)
23
            ]);
24
        }
25
    }
26
}

src/DependencyInjection/Compiler/ObjectMapperCompilerPass.php 1 location

@@ 10-26 (lines=17) @@
7
use Symfony\Component\DependencyInjection\ContainerBuilder;
8
use Symfony\Component\DependencyInjection\Reference;
9
10
class ObjectMapperCompilerPass implements CompilerPassInterface
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15
    public function process(ContainerBuilder $container)
16
    {
17
        $definition = $container->findDefinition('mrtn_json_api.object_mapper');
18
        $extensions = $container->findTaggedServiceIds('mrtn_json_api.object_mapper.handler');
19
20
        foreach ($extensions as $id => $tags) {
21
            $definition->addMethodCall('addHandler', [
22
                new Reference($id)
23
            ]);
24
        }
25
    }
26
}

src/DependencyInjection/Compiler/ViewListenerCompilerPass.php 1 location

@@ 10-26 (lines=17) @@
7
use Symfony\Component\DependencyInjection\ContainerBuilder;
8
use Symfony\Component\DependencyInjection\Reference;
9
10
class ViewListenerCompilerPass implements CompilerPassInterface
11
{
12
    /**
13
     * {@inheritdoc}
14
     */
15
    public function process(ContainerBuilder $container)
16
    {
17
        $definition = $container->findDefinition('mrtn_json_api.kernel_view.listener');
18
        $extensions = $container->findTaggedServiceIds('mrtn_json_api.view_listener.object_handler');
19
20
        foreach ($extensions as $id => $tags) {
21
            $definition->addMethodCall('addObjectHandler', [
22
                new Reference($id)
23
            ]);
24
        }
25
    }
26
}