We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
Conditions | 10 |
Paths | 13 |
Total Lines | 30 |
Code Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Tests | 18 |
CRAP Score | 10.0145 |
Changes | 1 | ||
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 |
||
17 | 38 | public function process(ContainerBuilder $container): void |
|
18 | { |
||
19 | 38 | if (!$container->hasParameter('overblog_graphql_types.config')) { |
|
20 | return; |
||
21 | } |
||
22 | /** @var array $configs */ |
||
23 | 38 | $configs = $container->getParameter('overblog_graphql_types.config'); |
|
24 | 38 | foreach ($configs as &$typeConfig) { |
|
25 | 37 | switch ($typeConfig['type']) { |
|
26 | 37 | case 'object': |
|
27 | 37 | if (isset($typeConfig['config']['fieldResolver'])) { |
|
28 | 2 | $this->resolveServiceIdAndMethod($container, $typeConfig['config']['fieldResolver']); |
|
29 | } |
||
30 | |||
31 | 37 | foreach ($typeConfig['config']['fields'] as &$field) { |
|
32 | 37 | if (isset($field['resolver'])) { |
|
33 | 30 | $this->resolveServiceIdAndMethod($container, $field['resolver']); |
|
34 | } |
||
35 | } |
||
36 | 37 | break; |
|
37 | |||
38 | 13 | case 'interface': |
|
39 | 12 | case 'union': |
|
40 | 5 | if (isset($typeConfig['config']['typeResolver'])) { |
|
41 | 3 | $this->resolveServiceIdAndMethod($container, $typeConfig['config']['typeResolver']); |
|
42 | } |
||
43 | 5 | break; |
|
44 | } |
||
45 | } |
||
46 | 38 | $container->setParameter('overblog_graphql_types.config', $configs); |
|
47 | 38 | } |
|
95 |