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 % |
| 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 | public function process(ContainerBuilder $container): void |
||
| 18 | { |
||
| 19 | if (!$container->hasParameter('overblog_graphql_types.config')) { |
||
| 20 | return; |
||
| 21 | } |
||
| 22 | /** @var array $configs */ |
||
| 23 | $configs = $container->getParameter('overblog_graphql_types.config'); |
||
| 24 | foreach ($configs as &$typeConfig) { |
||
| 25 | switch ($typeConfig['type']) { |
||
| 26 | case 'object': |
||
| 27 | if (isset($typeConfig['config']['fieldResolver'])) { |
||
| 28 | $this->resolveServiceIdAndMethod($container, $typeConfig['config']['fieldResolver']); |
||
| 29 | } |
||
| 30 | |||
| 31 | foreach ($typeConfig['config']['fields'] as &$field) { |
||
| 32 | if (isset($field['resolver'])) { |
||
| 33 | $this->resolveServiceIdAndMethod($container, $field['resolver']); |
||
| 34 | } |
||
| 35 | } |
||
| 36 | break; |
||
| 37 | |||
| 38 | case 'interface': |
||
| 39 | case 'union': |
||
| 40 | if (isset($typeConfig['config']['typeResolver'])) { |
||
| 41 | $this->resolveServiceIdAndMethod($container, $typeConfig['config']['typeResolver']); |
||
| 42 | } |
||
| 43 | break; |
||
| 44 | } |
||
| 45 | } |
||
| 46 | $container->setParameter('overblog_graphql_types.config', $configs); |
||
| 47 | } |
||
| 95 |