Conditions | 4 |
Paths | 2 |
Total Lines | 19 |
Code Lines | 7 |
Lines | 19 |
Ratio | 100 % |
Tests | 7 |
CRAP Score | 4 |
Changes | 3 | ||
Bugs | 0 | Features | 1 |
1 | <?php declare(strict_types = 1); |
||
26 | 1 | public function resolve(array $classDataArray, ClassMetadata $classMetadata) |
|
27 | { |
||
28 | // Iterate collection |
||
29 | // TODO Move this code into abstract class because this code are identical for three classes only with different configurator method name |
||
30 | 1 | if (array_key_exists('@attributes', $classDataArray)) { |
|
31 | // Iterate collection attribute configurators |
||
32 | 1 | foreach ($this->collectionConfigurators as $key => $collectionConfigurator) { |
|
33 | // If this is supported collection configurator |
||
34 | 1 | if (array_key_exists($key, $classDataArray['@attributes'])) { |
|
35 | /** @var ClassConfiguratorInterface $configurator Create instance */ |
||
36 | 1 | $configurator = new $collectionConfigurator($classDataArray['@attributes'][$key]); |
|
37 | // Fill in class metadata |
||
38 | 1 | $configurator->toClassMetadata($classMetadata); |
|
39 | } |
||
40 | } |
||
41 | } |
||
42 | |||
43 | 1 | return $classMetadata; |
|
44 | } |
||
45 | } |
||
46 |
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.