Conditions | 15 |
Paths | 2048 |
Total Lines | 56 |
Code Lines | 33 |
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 |
||
28 | public function load(array $configs, ContainerBuilder $container) |
||
29 | { |
||
30 | $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); |
||
31 | $loader->load('services.xml'); |
||
32 | |||
33 | $config = $this->processConfiguration(new Configuration(), $configs); |
||
34 | |||
35 | if (!empty($config['unalias_subscriber'])) { |
||
36 | // deprecation, remove in next major |
||
37 | trigger_error("unalias_subscriber is no longer used. This has moved to form transformers.", E_USER_DEPRECATED); |
||
38 | } |
||
39 | |||
40 | |||
41 | if (isset($config['static_ref'])) { |
||
42 | $container->getDefinition('zicht_url.static_refs')->addMethodCall('addAll', array($config['static_ref'])); |
||
43 | } |
||
44 | if (!empty($config['aliasing']) && $config['aliasing']['enabled'] === true) { |
||
45 | $this->loadAliasingConfig($container, $config['aliasing'], $loader); |
||
46 | $container->setAlias('zicht_url.sitemap_provider', new Alias('zicht_url.alias_sitemap_provider')); |
||
47 | } else { |
||
48 | $container->setAlias('zicht_url.sitemap_provider', new Alias('zicht_url.provider')); |
||
49 | } |
||
50 | if (!empty($config['logging'])) { |
||
51 | $loader->load('logging.xml'); |
||
52 | } |
||
53 | if (!empty($config['admin'])) { |
||
54 | $loader->load('admin.xml'); |
||
55 | } |
||
56 | if (!empty($aliasingConfig) && $config['caching']['enabled'] === true) { |
||
|
|||
57 | $loader->load('cache.xml'); |
||
58 | $subscriberDefinition = $container->getDefinition('zicht_url.cache_subscriber'); |
||
59 | $subscriberDefinition->replaceArgument(1, $config['caching']['entities']); |
||
60 | } |
||
61 | if (!empty($config['db_static_ref']) && $config['db_static_ref']['enabled'] === true) { |
||
62 | $loader->load('db.xml'); |
||
63 | } |
||
64 | |||
65 | if ($container->hasDefinition('zicht_url.aliasing')) { |
||
66 | $container->getDefinition('zicht_url.twig_extension')->addArgument(new Reference('zicht_url.aliasing')); |
||
67 | } |
||
68 | |||
69 | if ($container->hasDefinition('zicht_url.mapper.html')) { |
||
70 | $container->getDefinition('zicht_url.mapper.html')->addMethodCall('addAttributes', [$config['html_attributes']]); |
||
71 | } |
||
72 | |||
73 | if ($container->hasDefinition('zicht_url.listener.strict_public_url')) { |
||
74 | $container->getDefinition('zicht_url.listener.strict_public_url')->replaceArgument(0, $config['strict_public_url']); |
||
75 | } |
||
76 | |||
77 | if ($container->hasDefinition('zicht_url.validator.contains_url_alias')) { |
||
78 | $container->getDefinition('zicht_url.validator.contains_url_alias')->replaceArgument(1, $config['strict_public_url']); |
||
79 | } |
||
80 | |||
81 | $formResources = $container->getParameter('twig.form.resources'); |
||
82 | $formResources[]= 'ZichtUrlBundle::form_theme.html.twig'; |
||
83 | $container->setParameter('twig.form.resources', $formResources); |
||
84 | } |
||
114 |