Conditions | 4 |
Paths | 2 |
Total Lines | 18 |
Code Lines | 7 |
Lines | 18 |
Ratio | 100 % |
Tests | 7 |
CRAP Score | 4 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php declare(strict_types = 1); |
||
25 | 1 | public function resolve(array $parameterDataArray, ParameterMetadata $parameterMetadata) |
|
26 | { |
||
27 | // Iterate collection |
||
28 | 1 | if (array_key_exists('@attributes', $parameterDataArray)) { |
|
29 | // Iterate collection attribute configurators |
||
30 | 1 | foreach ($this->collectionConfigurators as $key => $collectionConfigurator) { |
|
31 | // If this is supported collection configurator |
||
32 | 1 | if (array_key_exists($key, $parameterDataArray['@attributes'])) { |
|
33 | /** @var ParameterConfiguratorInterface $configurator Create instance */ |
||
34 | 1 | $configurator = new $collectionConfigurator($parameterDataArray['@attributes'][$key]); |
|
35 | // Fill in class metadata |
||
36 | 1 | $configurator->toParameterMetadata($parameterMetadata); |
|
37 | } |
||
38 | } |
||
39 | } |
||
40 | |||
41 | 1 | return $parameterMetadata; |
|
42 | } |
||
43 | } |
||
44 |
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.