Conditions | 1 |
Paths | 1 |
Total Lines | 56 |
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 |
||
73 | protected function configureContainer(ContainerBuilder $containerBuilder, LoaderInterface $loader): void |
||
|
|||
74 | { |
||
75 | $containerBuilder->register('templating')->setSynthetic(true); |
||
76 | $containerBuilder->register('templating.locator')->setSynthetic(true); |
||
77 | $containerBuilder->register('templating.name_parser')->setSynthetic(true); |
||
78 | $containerBuilder->register('mailer')->setSynthetic(true); |
||
79 | |||
80 | $containerBuilder->loadFromExtension('framework', [ |
||
81 | 'secret' => '50n474.U53r', |
||
82 | 'session' => [ |
||
83 | 'handler_id' => 'session.handler.native_file', |
||
84 | 'storage_id' => 'session.storage.mock_file', |
||
85 | 'name' => 'MOCKSESSID', |
||
86 | ], |
||
87 | 'translator' => null, |
||
88 | 'validation' => [ |
||
89 | 'enabled' => true, |
||
90 | ], |
||
91 | 'form' => [ |
||
92 | 'enabled' => true, |
||
93 | ], |
||
94 | 'assets' => null, |
||
95 | 'test' => true, |
||
96 | 'profiler' => [ |
||
97 | 'enabled' => true, |
||
98 | 'collect' => false, |
||
99 | ], |
||
100 | ]); |
||
101 | |||
102 | $containerBuilder->loadFromExtension('security', [ |
||
103 | 'firewalls' => ['api' => ['anonymous' => true]], |
||
104 | 'providers' => ['in_memory' => ['memory' => null]], |
||
105 | ]); |
||
106 | |||
107 | $containerBuilder->loadFromExtension('twig', [ |
||
108 | 'strict_variables' => '%kernel.debug%', |
||
109 | 'exception_controller' => null, |
||
110 | ]); |
||
111 | |||
112 | $containerBuilder->loadFromExtension('doctrine', [ |
||
113 | 'dbal' => [ |
||
114 | 'connections' => [ |
||
115 | 'default' => [ |
||
116 | 'driver' => 'pdo_sqlite', |
||
117 | ], |
||
118 | ], |
||
119 | ], |
||
120 | 'orm' => [ |
||
121 | 'default_entity_manager' => 'default', |
||
122 | ], |
||
123 | ]); |
||
124 | |||
125 | $containerBuilder->loadFromExtension('fos_rest', [ |
||
126 | 'param_fetcher_listener' => true, |
||
127 | ]); |
||
128 | } |
||
129 | |||
135 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.