| Conditions | 6 |
| Paths | 10 |
| Total Lines | 23 |
| Code Lines | 14 |
| Lines | 12 |
| Ratio | 52.17 % |
| Changes | 2 | ||
| Bugs | 1 | Features | 1 |
| 1 | <?php |
||
| 21 | public function process(ContainerBuilder $container) |
||
| 22 | { |
||
| 23 | if (!$container->hasDefinition('jose.checker_manager')) { |
||
| 24 | return; |
||
| 25 | } |
||
| 26 | |||
| 27 | $definition = $container->getDefinition('jose.checker_manager'); |
||
| 28 | |||
| 29 | $taggedClaimCheckerServices = $container->findTaggedServiceIds('jose.checker.claim'); |
||
| 30 | $taggedHeaderCheckerServices = $container->findTaggedServiceIds('jose.checker.header'); |
||
| 31 | View Code Duplication | foreach ($taggedClaimCheckerServices as $id => $tags) { |
|
|
|
|||
| 32 | foreach ($tags as $attributes) { |
||
| 33 | Assertion::keyExists($attributes, 'alias', sprintf("The claim checker '%s' does not have any 'alias' attribute.", $id)); |
||
| 34 | $definition->addMethodCall('addClaimChecker', [new Reference($id), $attributes['alias']]); |
||
| 35 | } |
||
| 36 | } |
||
| 37 | View Code Duplication | foreach ($taggedHeaderCheckerServices as $id => $tags) { |
|
| 38 | foreach ($tags as $attributes) { |
||
| 39 | Assertion::keyExists($attributes, 'alias', sprintf("The header checker '%s' does not have any 'alias' attribute.", $id)); |
||
| 40 | $definition->addMethodCall('addHeaderChecker', [new Reference($id), $attributes['alias']]); |
||
| 41 | } |
||
| 42 | } |
||
| 43 | } |
||
| 44 | } |
||
| 45 |
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.