Conditions | 4 |
Paths | 4 |
Total Lines | 22 |
Code Lines | 10 |
Lines | 22 |
Ratio | 100 % |
Changes | 0 |
1 | <?php |
||
28 | public function process(ContainerBuilder $container) |
||
29 | { |
||
30 | // always first check if the primary service is defined |
||
31 | if (!$container->has('symball_report.style')) { |
||
32 | return; |
||
33 | } |
||
34 | |||
35 | $definition = $container->findDefinition('symball_report.style'); |
||
36 | |||
37 | // find all service IDs with the app.mail_transport tag |
||
38 | $taggedServices = $container->findTaggedServiceIds('symball_report.style'); |
||
39 | |||
40 | foreach ($taggedServices as $id => $tags) { |
||
41 | foreach ($tags as $attributes) { |
||
42 | // add the transport service to the ChainTransport service |
||
43 | $definition->addMethodCall('addStyle', array( |
||
44 | new Reference($id), |
||
45 | $attributes["alias"], |
||
46 | )); |
||
47 | } |
||
48 | } |
||
49 | } |
||
50 | } |
||
51 |
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.