| Conditions | 7 | 
| Paths | 18 | 
| Total Lines | 51 | 
| Code Lines | 33 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 11 | ||
| Bugs | 0 | Features | 2 | 
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 | ||
| 33 | public function load(array $config, ContainerBuilder $container) | ||
| 34 |     { | ||
| 35 | $processor = new Processor(); | ||
| 36 | $config = $processor->processConfiguration(new Configuration(), $config); | ||
| 37 | |||
| 38 |         $container->setParameter('logging.application_name', $config['logging']['application_name']); | ||
| 39 | |||
| 40 | $loader = new YamlFileLoader( | ||
| 41 | $container, | ||
| 42 | new FileLocator(__DIR__ . '/../Resources/config') | ||
| 43 | ); | ||
| 44 |         $loader->load('services.yml'); | ||
| 45 | |||
| 46 |         if (isset($config['loa_definition'])) { | ||
| 47 | $this->defineLoas($config['loa_definition'], $container); | ||
| 48 |         } else { | ||
| 49 |             $container->removeDefinition('surfnet_stepup.service.loa_resolution'); | ||
| 50 | } | ||
| 51 | |||
| 52 |         if ($config['sms']['enabled'] === false) { | ||
| 53 |             $container->removeDefinition('surfnet_stepup.service.sms_second_factor'); | ||
| 54 |             $container->removeDefinition('surfnet_stepup.service.challenge_handler'); | ||
| 55 |             $container->removeDefinition('surfnet_stepup.service.sms_second_factor'); | ||
| 56 |         } else { | ||
| 57 | $this->configureSmsSecondFactorServices($config, $container); | ||
| 58 | |||
| 59 |             if (!$config['gateway_api']['enabled'] && $config['sms']['service'] === Configuration::DEFAULT_SMS_SERVICE) { | ||
|  | |||
| 60 | throw new RuntimeException( | ||
| 61 | 'The gateway API is not enabled and no replacement SMS service is configured' | ||
| 62 | ); | ||
| 63 | } | ||
| 64 | } | ||
| 65 | |||
| 66 |         if ($config['gateway_api']['enabled']) { | ||
| 67 | $this->configureGatewayApiClient($config, $container); | ||
| 68 |         } else { | ||
| 69 | // Remove the Gateway API SMS service and its Guzzle client. | ||
| 70 |             $container->removeDefinition('surfnet_stepup.service.gateway_api_sms'); | ||
| 71 |             $container->removeDefinition('surfnet_stepup.guzzle.gateway_api'); | ||
| 72 | } | ||
| 73 | |||
| 74 |         if ($config['locale_cookie']['enabled']) { | ||
| 75 | $this->configureLocaleCookieSettings($config, $container); | ||
| 76 |         } else { | ||
| 77 |             $container->removeDefinition('surfnet_stepup.locale_cookie_helper'); | ||
| 78 |             $container->removeDefinition('surfnet_stepup.locale_cookie_settings'); | ||
| 79 | } | ||
| 80 | |||
| 81 |         $container->getDefinition('surfnet_stepup.form.choice_list.locales') | ||
| 82 |             ->replaceArgument(0, $container->getParameter('locales')); | ||
| 83 | } | ||
| 84 | |||
| 160 | 
Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.