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 | 31 |
Lines | 0 |
Ratio | 0 % |
Tests | 12 |
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 |
||
32 | private static function processRelayConfigs($typeName, $definitionBuilderClass, array $configs) |
||
33 | { |
||
34 | 37 | foreach ($configs as $name => $config) { |
|
35 | if (isset($config['type']) && \is_string($config['type']) && $typeName === $config['type']) { |
||
36 | 37 | ||
37 | 37 | $configInherits = isset($config['inherits']) && \is_array($config['inherits']) ? $config['inherits'] : []; |
|
38 | 18 | ||
39 | $config = isset($config['config']) && \is_array($config['config']) ? $config['config'] : []; |
||
40 | 18 | ||
41 | 18 | if (empty($config['class_name'])) { |
|
42 | $config['class_name'] = \sprintf('%sType', $name); |
||
43 | 18 | } |
|
44 | 17 | if (empty($config['name'])) { |
|
45 | $config['name'] = $name; |
||
46 | } |
||
47 | |||
48 | 18 | /** @var MappingInterface $builder */ |
|
49 | $builder = new $definitionBuilderClass(); |
||
50 | 18 | ||
51 | $connectionDefinition = $builder->toMappingDefinition($config); |
||
52 | 37 | ||
53 | if (!empty($configInherits)) { |
||
54 | $connectionDefinition[$name]['inherits'] = $configInherits; |
||
55 | } |
||
56 | 37 | ||
57 | $configs = \array_replace($configs, $connectionDefinition); |
||
58 | } |
||
59 | } |
||
60 | |||
61 | return $configs; |
||
62 | } |
||
63 | } |
||
64 |