We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| Conditions | 12 |
| Paths | 130 |
| Total Lines | 29 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 15 |
| CRAP Score | 12 |
| Changes | 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 |
||
| 34 | 42 | private static function processRelayConfigs($typeName, $definitionBuilderClass, array $configs) |
|
| 35 | { |
||
| 36 | 42 | foreach ($configs as $name => $config) { |
|
| 37 | 42 | if (isset($config['type']) && \is_string($config['type']) && $typeName === $config['type']) { |
|
| 38 | 19 | $configInherits = isset($config['inherits']) && \is_array($config['inherits']) ? $config['inherits'] : []; |
|
| 39 | |||
| 40 | 19 | $config = isset($config['config']) && \is_array($config['config']) ? $config['config'] : []; |
|
| 41 | |||
| 42 | 19 | if (empty($config['class_name'])) { |
|
| 43 | 19 | $config['class_name'] = \sprintf('%sType', $name); |
|
| 44 | } |
||
| 45 | 19 | if (empty($config['name'])) { |
|
| 46 | 18 | $config['name'] = $name; |
|
| 47 | } |
||
| 48 | |||
| 49 | /** @var MappingInterface $builder */ |
||
| 50 | 19 | $builder = new $definitionBuilderClass(); |
|
| 51 | |||
| 52 | 19 | $connectionDefinition = $builder->toMappingDefinition($config); |
|
| 53 | |||
| 54 | 19 | if (!empty($configInherits)) { |
|
| 55 | 1 | $connectionDefinition[$name]['inherits'] = $configInherits; |
|
| 56 | } |
||
| 57 | |||
| 58 | 19 | $configs = \array_replace($configs, $connectionDefinition); |
|
| 59 | } |
||
| 60 | } |
||
| 61 | |||
| 62 | 42 | return $configs; |
|
| 63 | } |
||
| 65 |