Conditions | 7 |
Paths | 12 |
Total Lines | 27 |
Lines | 14 |
Ratio | 51.85 % |
Changes | 0 |
1 | <?php |
||
19 | public function process(ContainerBuilder $container) |
||
20 | { |
||
21 | if ($container->hasDefinition('kunstmaan_media.media_manager')) { |
||
22 | $definition = $container->getDefinition('kunstmaan_media.media_manager'); |
||
23 | |||
24 | foreach ($container->findTaggedServiceIds('kunstmaan_media.media_handler') as $id => $attributes) { |
||
25 | $definition->addMethodCall('addHandler', array(new Reference($id))); |
||
26 | } |
||
27 | } |
||
28 | |||
29 | View Code Duplication | if ($container->hasDefinition('kunstmaan_media.icon_font_manager')) { |
|
|
|||
30 | $definition = $container->getDefinition('kunstmaan_media.icon_font_manager'); |
||
31 | |||
32 | foreach ($container->findTaggedServiceIds('kunstmaan_media.icon_font.loader') as $id => $attributes) { |
||
33 | $definition->addMethodCall('addLoader', array(new Reference($id), $id)); |
||
34 | } |
||
35 | } |
||
36 | |||
37 | // Inject the tagged resolvers into our cache manager override |
||
38 | View Code Duplication | if ($container->hasDefinition('kunstmaan_media.imagine.cache.manager')) { |
|
39 | $manager = $container->getDefinition('kunstmaan_media.imagine.cache.manager'); |
||
40 | |||
41 | foreach ($container->findTaggedServiceIds('liip_imagine.cache.resolver') as $id => $tag) { |
||
42 | $manager->addMethodCall('addResolver', [$tag[0]['resolver'], new Reference($id)]); |
||
43 | } |
||
44 | } |
||
45 | } |
||
46 | } |
||
47 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.