| Conditions | 4 | 
| Paths | 4 | 
| Total Lines | 20 | 
| Code Lines | 11 | 
| Lines | 14 | 
| Ratio | 70 % | 
| Tests | 12 | 
| CRAP Score | 4 | 
| 1 | <?php | ||
| 27 | 5 | public function process(ContainerBuilder $container) | |
| 28 |     { | ||
| 29 | 5 | $definition = $container->getDefinition($this->service); | |
| 30 | 5 | $ids = $container->findTaggedServiceIds($this->tag); | |
| 31 | |||
| 32 | 5 | View Code Duplication |         foreach ($ids as $id => $tags) { | 
| 1 ignored issue–
                            show | |||
| 33 | 4 |             foreach ($tags as $tag) { | |
| 34 | 4 |                 if (!isset($tag['class'])) { | |
| 35 | 2 | throw new RuntimeException( | |
| 36 | 2 | 'The class attribute must be defined' | |
| 37 | ); | ||
| 38 | } | ||
| 39 | |||
| 40 | 2 | $definition->addMethodCall( | |
| 41 | 2 | 'register', | |
| 42 | 2 | [$tag['class'], new Reference($id)] | |
| 43 | ); | ||
| 44 | } | ||
| 45 | } | ||
| 46 | 3 | } | |
| 47 | } | ||
| 48 | 
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.