Conditions | 16 |
Paths | > 20000 |
Total Lines | 62 |
Code Lines | 40 |
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 |
||
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 | |||
28 | $loader->load('bundle.xml'); |
||
29 | $loader->load('controller_helper.xml'); |
||
30 | |||
31 | foreach ($config['detect'] as $type => $isActivated) { |
||
32 | $container->setParameter('knp_rad.detect.'.$type, $isActivated); |
||
33 | } |
||
34 | |||
35 | if ($config['domain_event']) { |
||
36 | $loader->load('domain_event.xml'); |
||
37 | } |
||
38 | if ($config['mailer']['logger']) { |
||
39 | $loader->load('mailer_logger.xml'); |
||
40 | } |
||
41 | if ($config['mailer']['message_factory']) { |
||
42 | $loader->load('mailer_message_factory.xml'); |
||
43 | } |
||
44 | if ($config['listener']['view']) { |
||
45 | $loader->load('view_listener.xml'); |
||
46 | } |
||
47 | if ($config['listener']['resource_resolver']) { |
||
48 | $loader->load('resource_resolver_listener.xml'); |
||
49 | } |
||
50 | if ($config['listener']['orm_user']) { |
||
51 | $loader->load('orm_user_listener.xml'); |
||
52 | } |
||
53 | if ($config['listener']['exception_rethrow']) { |
||
54 | $loader->load('exception_rethrow_listener.xml'); |
||
55 | } |
||
56 | if ($config['routing_loader']) { |
||
57 | $loader->load('routing_loader.xml'); |
||
58 | } |
||
59 | if ($config['form_manager']) { |
||
60 | $loader->load('form_manager.xml'); |
||
61 | } |
||
62 | if ($config['security_voter']) { |
||
63 | $loader->load('security_voter.xml'); |
||
64 | } |
||
65 | if ($config['datatable']) { |
||
66 | $loader->load('datatable.xml'); |
||
67 | } |
||
68 | if ($config['alice']) { |
||
69 | $loader->load('alice.xml'); |
||
70 | } |
||
71 | $container->setParameter('knp_rad.csrf_link.intention', $config['csrf_links']['intention']); |
||
72 | if ($this->isConfigEnabled($container, $config['csrf_links'])) { |
||
73 | $loader->load('link_attributes.xml'); |
||
74 | } |
||
75 | $container->setParameter('knp_rad.flashes.trans_catalog', $config['flashes']['trans_catalog']); |
||
76 | if ($this->isConfigEnabled($container, $config['flashes'])) { |
||
77 | $loader->load('flashes.xml'); |
||
78 | } |
||
79 | $container->setParameter('knp_rad.decision_manager.id', $config['security']['decision_manager']); |
||
80 | |||
81 | $container->setAlias('knp_rad.resource.resolver.resource', 'knp_rad.resource.resolver.resource.aggregate'); |
||
82 | } |
||
83 | |||
89 |