We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| Conditions | 13 |
| Paths | 29 |
| Total Lines | 49 |
| Code Lines | 27 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 26 |
| CRAP Score | 15.872 |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 39 | 26 | public function solve($values, $config = null) |
|
|
|
|||
| 40 | { |
||
| 41 | 26 | foreach ($values as $field => &$options) { |
|
| 42 | 26 | if (isset($options['builder'])) { |
|
| 43 | 19 | $builderConfig = isset($options['builderConfig']) ? $options['builderConfig'] : []; |
|
| 44 | |||
| 45 | 19 | $access = isset($options['access']) ? $options['access'] : null; |
|
| 46 | 19 | $options = $this->solveBuilder($options['builder'], $builderConfig, $this->fieldResolver, $field); |
|
| 47 | 19 | $options['access'] = $access; |
|
| 48 | 19 | $options = $this->resolveResolveAndAccessIfNeeded($options); |
|
| 49 | |||
| 50 | 19 | unset($options['builderConfig'], $options['builder']); |
|
| 51 | |||
| 52 | 19 | continue; |
|
| 53 | } |
||
| 54 | |||
| 55 | 26 | if (isset($options['type'])) { |
|
| 56 | 26 | $options['type'] = $this->typeConfigSolution->solveTypeCallback($options['type']); |
|
| 57 | 26 | } |
|
| 58 | |||
| 59 | 26 | if (isset($options['args'])) { |
|
| 60 | foreach ($options['args'] as &$argsOptions) { |
||
| 61 | $argsOptions['type'] = $this->typeConfigSolution->solveTypeCallback($argsOptions['type']); |
||
| 62 | if (isset($argsOptions['defaultValue'])) { |
||
| 63 | $argsOptions['defaultValue'] = $this->solveUsingExpressionLanguageIfNeeded($argsOptions['defaultValue']); |
||
| 64 | } |
||
| 65 | } |
||
| 66 | } |
||
| 67 | |||
| 68 | 26 | if (isset($options['argsBuilder'])) { |
|
| 69 | 7 | $argsBuilderConfig = isset($options['argsBuilder']['config']) ? $options['argsBuilder']['config'] : []; |
|
| 70 | |||
| 71 | 7 | $options['args'] = array_merge( |
|
| 72 | 7 | $this->solveBuilder($options['argsBuilder']['builder'], $argsBuilderConfig, $this->argResolver), |
|
| 73 | 7 | isset($options['args']) ? $options['args'] : [] |
|
| 74 | 7 | ); |
|
| 75 | |||
| 76 | 7 | unset($options['argsBuilder']); |
|
| 77 | 7 | } |
|
| 78 | |||
| 79 | 26 | $options = $this->resolveResolveAndAccessIfNeeded($options); |
|
| 80 | |||
| 81 | 26 | if (isset($options['deprecationReason'])) { |
|
| 82 | $options['deprecationReason'] = $this->solveUsingExpressionLanguageIfNeeded($options['deprecationReason']); |
||
| 83 | } |
||
| 84 | 26 | } |
|
| 85 | |||
| 86 | 26 | return $values; |
|
| 87 | } |
||
| 88 | |||
| 189 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.