Code Duplication    Length = 17-21 lines in 2 locations

src/RunOpenCode/Bundle/ExchangeRate/DependencyInjection/CompilerPass/RatesConfigurationRegistryCompilerPass.php 1 location

@@ 21-41 (lines=21) @@
18
 *
19
 * @package RunOpenCode\Bundle\ExchangeRate\DependencyInjection\CompilerPass
20
 */
21
class RatesConfigurationRegistryCompilerPass implements CompilerPassInterface
22
{
23
    /**
24
     * {@inheritdoc}
25
     */
26
    public function process(ContainerBuilder $container)
27
    {
28
29
        if (!$container->hasDefinition('runopencode.exchange_rate.registry.rates')) {
30
            return;
31
        }
32
33
        $registry = $container->findDefinition('runopencode.exchange_rate.registry.rates');
34
35
        foreach (array_keys($container->findTaggedServiceIds('runopencode.exchange_rate.rate_configuration')) as $id) {
36
37
            $registry
38
                ->addMethodCall('add', [new Reference($id)]);
39
        }
40
    }
41
}
42

src/RunOpenCode/Bundle/ExchangeRate/DependencyInjection/CompilerPass/SourcesCompilerPass.php 1 location

@@ 24-40 (lines=17) @@
21
 *
22
 * @package RunOpenCode\Bundle\ExchangeRate\DependencyInjection\CompilerPass
23
 */
24
class SourcesCompilerPass implements CompilerPassInterface
25
{
26
    /**
27
     * {@inheritdoc}
28
     */
29
    public function process(ContainerBuilder $container)
30
    {
31
        if ($container->hasDefinition('runopencode.exchange_rate.registry.sources')) {
32
33
            $definition = $container->getDefinition('runopencode.exchange_rate.registry.sources');
34
35
            foreach ($container->findTaggedServiceIds('runopencode.exchange_rate.source') as $id => $tags) {
36
                $definition->addMethodCall('add', [new Reference($id)]);
37
            }
38
        }
39
    }
40
}
41