Code Duplication    Length = 11-14 lines in 3 locations

src/DependencyInjection/Compiler/RegisterMetadataFactoriesPass.php 1 location

@@ 24-34 (lines=11) @@
21
        $ids = $container->findTaggedServiceIds('innmind_neo4j.metadata_factory');
22
        $services = [];
23
24
        foreach ($ids as $id => $tags) {
25
            foreach ($tags as $tag) {
26
                if (!isset($tag['type'])) {
27
                    throw new RuntimeException(
28
                        'The type attribute must be defined'
29
                    );
30
                }
31
32
                $services[$tag['type']] = new Reference($id);
33
            }
34
        }
35
36
        $definition->replaceArgument(1, $services);
37
    }

src/DependencyInjection/Compiler/RegisterTagMapPass.php 1 location

@@ 33-43 (lines=11) @@
30
        $ids = $container->findTaggedServiceIds($this->tag);
31
        $services = [];
32
33
        foreach ($ids as $id => $tags) {
34
            foreach ($tags as $tag) {
35
                if (!isset($tag['type'])) {
36
                    throw new RuntimeException(
37
                        'The type attribute must be defined'
38
                    );
39
                }
40
41
                $services[$tag['type']] = new Reference($id);
42
            }
43
        }
44
45
        $definition->replaceArgument(2, $services);
46
    }

src/DependencyInjection/Compiler/RegistrableServicePass.php 1 location

@@ 32-45 (lines=14) @@
29
        $definition = $container->getDefinition($this->service);
30
        $ids = $container->findTaggedServiceIds($this->tag);
31
32
        foreach ($ids as $id => $tags) {
33
            foreach ($tags as $tag) {
34
                if (!isset($tag['class'])) {
35
                    throw new RuntimeException(
36
                        'The class attribute must be defined'
37
                    );
38
                }
39
40
                $definition->addMethodCall(
41
                    'register',
42
                    [$tag['class'], new Reference($id)]
43
                );
44
            }
45
        }
46
    }
47
}
48