| Conditions | 6 | 
| Paths | 16 | 
| Total Lines | 71 | 
| Lines | 0 | 
| Ratio | 0 % | 
| 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 | ||
| 70 | public function load(array $configs, ContainerBuilder $container) | ||
| 71 |     { | ||
| 72 | $config = $this->processConfiguration( | ||
| 73 | $this->getConfiguration($configs, $container), | ||
|  | |||
| 74 | $configs | ||
| 75 | ); | ||
| 76 | |||
| 77 |         if (interface_exists(MimeTypeGuesserInterface::class)) { | ||
| 78 | $mimeTypes = new Definition(MimeTypes::class); | ||
| 79 | $mimeTypes->setFactory([MimeTypes::class, 'getDefault']); | ||
| 80 | |||
| 81 |             $container->setDefinition('liip_imagine.mime_types', $mimeTypes); | ||
| 82 | } | ||
| 83 | |||
| 84 |         $container->setParameter('liip_imagine.resolvers', $config['resolvers']); | ||
| 85 |         $container->setParameter('liip_imagine.loaders', $config['loaders']); | ||
| 86 | |||
| 87 | $this->loadResolvers($config['resolvers'], $container); | ||
| 88 | $this->loadLoaders($config['loaders'], $container); | ||
| 89 | |||
| 90 | $loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); | ||
| 91 |         $loader->load('imagine.xml'); | ||
| 92 |         $loader->load('commands.xml'); | ||
| 93 | |||
| 94 |         if ($config['enqueue']) { | ||
| 95 |             $loader->load('enqueue.xml'); | ||
| 96 | } | ||
| 97 | |||
| 98 |         if ($config['templating']) { | ||
| 99 |             $loader->load('templating.xml'); | ||
| 100 | } | ||
| 101 | |||
| 102 |         $container->setParameter('liip_imagine.driver_service', 'liip_imagine.'.$config['driver']); | ||
| 103 | |||
| 104 | $container | ||
| 105 |             ->getDefinition('liip_imagine.controller.config') | ||
| 106 | ->replaceArgument(0, $config['controller']['redirect_response_code']); | ||
| 107 | |||
| 108 |         $container->setAlias('liip_imagine', new Alias('liip_imagine.'.$config['driver'])); | ||
| 109 |         $container->setAlias(CacheManager::class, new Alias('liip_imagine.cache.manager', false)); | ||
| 110 |         $container->setAlias(DataManager::class, new Alias('liip_imagine.data.manager', false)); | ||
| 111 |         $container->setAlias(FilterManager::class, new Alias('liip_imagine.filter.manager', false)); | ||
| 112 | |||
| 113 |         $container->setParameter('liip_imagine.cache.resolver.default', $config['cache']); | ||
| 114 | |||
| 115 |         $container->setParameter('liip_imagine.default_image', $config['default_image']); | ||
| 116 | |||
| 117 | $filterSets = $this->createFilterSets($config['default_filter_set_settings'], $config['filter_sets']); | ||
| 118 | |||
| 119 |         $container->setParameter('liip_imagine.filter_sets', $filterSets); | ||
| 120 |         $container->setParameter('liip_imagine.binary.loader.default', $config['data_loader']); | ||
| 121 | |||
| 122 |         $container->setParameter('liip_imagine.controller.filter_action', $config['controller']['filter_action']); | ||
| 123 |         $container->setParameter('liip_imagine.controller.filter_runtime_action', $config['controller']['filter_runtime_action']); | ||
| 124 | |||
| 125 |         $container->setParameter('twig.form.resources', array_merge( | ||
| 126 |             $container->hasParameter('twig.form.resources') ? $container->getParameter('twig.form.resources') : [], | ||
| 127 | ['@LiipImagine/Form/form_div_layout.html.twig'] | ||
| 128 | )); | ||
| 129 | |||
| 130 |         if ($container->hasDefinition('liip_imagine.mime_types')) { | ||
| 131 |             $mimeTypes = $container->getDefinition('liip_imagine.mime_types'); | ||
| 132 |             $container->getDefinition('liip_imagine.binary.mime_type_guesser') | ||
| 133 | ->replaceArgument(0, $mimeTypes); | ||
| 134 | |||
| 135 |             $container->getDefinition('liip_imagine.data.manager') | ||
| 136 | ->replaceArgument(1, $mimeTypes); | ||
| 137 | } | ||
| 138 | |||
| 139 | $this->deprecationTemplatingFilterHelper($container); | ||
| 140 | } | ||
| 141 | |||
| 195 | 
Unless you are absolutely sure that the expression can never be null because of other conditions, we strongly recommend to add an additional type check to your code: