Conditions | 6 |
Paths | 18 |
Total Lines | 58 |
Code Lines | 38 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
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 |
||
21 | public function load(array $configs, ContainerBuilder $container) |
||
22 | { |
||
23 | $configuration = new Configuration(); |
||
24 | $config = $this->processConfiguration($configuration, $configs); |
||
25 | |||
26 | $loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); |
||
27 | $loader->load('services.xml'); |
||
28 | |||
29 | if (key_exists('codemirror', $config)) { |
||
30 | $loader->load('form.xml'); |
||
31 | |||
32 | if (key_exists('paths', $config['codemirror'])) { |
||
33 | $container |
||
34 | ->getDefinition('nvbooster_assets.twig_extension') |
||
35 | ->addArgument($config['codemirror']['paths']); |
||
36 | } |
||
37 | |||
38 | $container |
||
39 | ->getDefinition('nvbooster_assets.formtype.asset') |
||
40 | ->addArgument(array_merge( |
||
41 | array( |
||
42 | 'theme' => 'eclipse', |
||
43 | 'mode' => 'xml', |
||
44 | 'lineNumbers' => true |
||
45 | |||
46 | ), $config['codemirror']['options'] |
||
47 | )); |
||
48 | } |
||
49 | |||
50 | $bundles = $container->getParameter('kernel.bundles'); |
||
51 | if (isset($bundles['SonataAdminBundle'])) { |
||
52 | $loader->load('admin.xml'); |
||
53 | |||
54 | if (key_exists('codemirror', $config)) { |
||
55 | $container |
||
56 | ->getDefinition('nvbooster_assets.asset_admin') |
||
57 | ->addMethodCall('enableCodeMirror'); |
||
58 | } |
||
59 | } |
||
60 | |||
61 | $container |
||
62 | ->getDefinition('nvbooster_assets.routing.prefix_provider') |
||
63 | ->replaceArgument(0, $config['routing']['base_uri']); |
||
64 | |||
65 | if ($config['phpcr']['root_path']) { |
||
66 | $container->setParameter('nvbooster_assets.phpcr.root', $config['phpcr']['root_path']); |
||
67 | } |
||
68 | |||
69 | $root = $container->getParameter('nvbooster_assets.phpcr.root'); |
||
70 | |||
71 | $container |
||
72 | ->getDefinition('nvbooster_assets.phpcr.initializer') |
||
73 | ->addArgument(array($root)); |
||
74 | |||
75 | $container |
||
76 | ->getDefinition('nvbooster_assets.controller') |
||
77 | ->addArgument($config['filters']); |
||
78 | } |
||
79 | |||
106 |