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 | 30 |
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 | |||
39 | 19 | $configInherits = isset($config['inherits']) && \is_array($config['inherits']) ? $config['inherits'] : []; |
|
40 | |||
41 | 19 | $config = isset($config['config']) && \is_array($config['config']) ? $config['config'] : []; |
|
42 | |||
43 | 19 | if (empty($config['class_name'])) { |
|
44 | 19 | $config['class_name'] = \sprintf('%sType', $name); |
|
45 | } |
||
46 | 19 | if (empty($config['name'])) { |
|
47 | 18 | $config['name'] = $name; |
|
48 | } |
||
49 | |||
50 | /** @var MappingInterface $builder */ |
||
51 | 19 | $builder = new $definitionBuilderClass(); |
|
52 | |||
53 | 19 | $connectionDefinition = $builder->toMappingDefinition($config); |
|
54 | |||
55 | 19 | if (!empty($configInherits)) { |
|
56 | 1 | $connectionDefinition[$name]['inherits'] = $configInherits; |
|
57 | } |
||
58 | |||
59 | 19 | $configs = \array_replace($configs, $connectionDefinition); |
|
60 | } |
||
61 | } |
||
62 | |||
63 | 42 | return $configs; |
|
64 | } |
||
66 |