Conditions | 1 |
Paths | 1 |
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 |
||
37 | protected function configureContainer(ContainerBuilder $containerBuilder, LoaderInterface $loader): void |
||
38 | { |
||
39 | $containerBuilder->loadFromExtension('framework', [ |
||
40 | 'secret' => 'S0ME_SECRET', |
||
41 | 'templating' => [ |
||
42 | 'engines' => ['twig'], |
||
43 | ], |
||
44 | ]); |
||
45 | |||
46 | $containerBuilder->loadFromExtension('security', ['firewalls' => ['main' => ['anonymous' => null]]]); |
||
47 | |||
48 | $containerBuilder->loadFromExtension( |
||
49 | 'sonata_block', |
||
50 | ['blocks' => ['sonata.block.service.template' => ['settings' => ['context' => null]]]] |
||
51 | ); |
||
52 | |||
53 | $containerBuilder->loadFromExtension('sylius_ui', ['events' => [ |
||
54 | 'first_event' => [ |
||
55 | 'blocks' => [ |
||
56 | 'third' => ['template' => 'blocks/txt/third.txt.twig', 'priority' => -5], |
||
57 | 'first' => ['template' => 'blocks/txt/first.txt.twig', 'priority' => 5], |
||
58 | 'second' => 'blocks/txt/second.txt.twig', |
||
59 | ], |
||
60 | ], |
||
61 | 'second_event' => [ |
||
62 | 'blocks' => [ |
||
63 | 'context' => 'blocks/txt/context.txt.twig', |
||
64 | ], |
||
65 | ], |
||
66 | 'event' => [ |
||
67 | 'blocks' => [ |
||
68 | 'first' => ['template' => 'blocks/html/first.html.twig', 'priority' => 5], |
||
69 | 'context' => ['template' => 'blocks/html/context.html.twig', 'priority' => -5], |
||
70 | ], |
||
71 | ], |
||
72 | 'context_template_block' => [ |
||
73 | 'blocks' => [ |
||
74 | 'block' => [ |
||
75 | 'template' => 'blocks/contextTemplateBlock/block.txt.twig', |
||
76 | 'context' => [ |
||
77 | 'option1' => 'foo', |
||
78 | 'option2' => 'bar', |
||
79 | ], |
||
80 | ], |
||
81 | ], |
||
82 | ], |
||
83 | 'multiple_events_generic' => [ |
||
84 | 'blocks' => [ |
||
85 | 'first' => [ |
||
86 | 'template' => 'blocks/multipleEvents/genericFirst.txt.twig', |
||
87 | ], |
||
88 | 'second' => [ |
||
89 | 'template' => 'blocks/multipleEvents/genericSecond.txt.twig', |
||
90 | 'context' => ['value' => 13], |
||
91 | ], |
||
92 | ], |
||
93 | ], |
||
94 | 'multiple_events_specific' => [ |
||
95 | 'blocks' => [ |
||
96 | 'specific' => [ |
||
97 | 'template' => 'blocks/multipleEvents/specific.txt.twig', |
||
98 | 'priority' => 3, |
||
99 | ], |
||
100 | 'second' => [ |
||
101 | 'context' => ['value' => 42], |
||
102 | 'priority' => 5, |
||
103 | ], |
||
104 | ], |
||
105 | ], |
||
106 | ]]); |
||
107 | } |
||
108 | |||
113 |