Code Duplication    Length = 25-27 lines in 2 locations

src/DependencyInjection/Compiler/RegisterGatewaysPass.php 1 location

@@ 13-37 (lines=25) @@
10
    Reference
11
};
12
13
final class RegisterGatewaysPass implements CompilerPassInterface
14
{
15
    /**
16
     * {@inheritdoc}
17
     */
18
    public function process(ContainerBuilder $container)
19
    {
20
        $ids = $container->findTaggedServiceIds('innmind_rest_server.gateway');
21
        $gateways = [];
22
23
        foreach ($ids as $id => $tags) {
24
            foreach ($tags as $tag => $attributes) {
25
                if (!isset($attributes['alias'])) {
26
                    throw new MissingAlias;
27
                }
28
29
                $gateways[$attributes['alias']] = new Reference($id);
30
            }
31
        }
32
33
        $container
34
            ->getDefinition('innmind_rest_server.gateways')
35
            ->addArgument($gateways);
36
    }
37
}
38

src/DependencyInjection/Compiler/RegisterHttpHeaderFactoriesPass.php 1 location

@@ 13-39 (lines=27) @@
10
    Reference
11
};
12
13
final class RegisterHttpHeaderFactoriesPass implements CompilerPassInterface
14
{
15
    /**
16
     * {@inheritdoc}
17
     */
18
    public function process(ContainerBuilder $container)
19
    {
20
        $ids = $container->findTaggedServiceIds(
21
            'innmind_rest_server.http_header_factory'
22
        );
23
        $factories = [];
24
25
        foreach ($ids as $id => $tags) {
26
            foreach ($tags as $tag => $attributes) {
27
                if (!isset($attributes['alias'])) {
28
                    throw new MissingAlias;
29
                }
30
31
                $factories[$attributes['alias']] = new Reference($id);
32
            }
33
        }
34
35
        $container
36
            ->getDefinition('innmind_rest_server.http.factory.header.default')
37
            ->addArgument($factories);
38
    }
39
}
40