Conditions | 2 |
Paths | 2 |
Total Lines | 162 |
Code Lines | 123 |
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 |
||
144 | public function test_tabelize() |
||
145 | { |
||
146 | $values = new Helper_Table([ |
||
147 | 'a' => [ |
||
148 | 'a1' => [ |
||
149 | 'a2' => [ |
||
150 | 'a3' => 1, |
||
151 | 'b3' => 1, |
||
152 | ], |
||
153 | 'b2' => [ |
||
154 | 'a3' => 1, |
||
155 | 'b3' => 1, |
||
156 | ], |
||
157 | 'c2' => [ |
||
158 | 'a3' => 1, |
||
159 | 'b3' => 1, |
||
160 | ], |
||
161 | ], |
||
162 | 'b1' => [ |
||
163 | 'a2' => [ |
||
164 | 'a3' => 1, |
||
165 | 'b3' => 1, |
||
166 | ], |
||
167 | 'b2' => [ |
||
168 | 'a3' => 1, |
||
169 | 'b3' => 1, |
||
170 | ], |
||
171 | 'c2' => [ |
||
172 | 'a3' => 1, |
||
173 | 'b3' => 1, |
||
174 | ], |
||
175 | ], |
||
176 | ], |
||
177 | 'b' => [ |
||
178 | 'a1' => [ |
||
179 | 'a2' => [ |
||
180 | 'a3' => 1, |
||
181 | 'b3' => 1, |
||
182 | ], |
||
183 | 'b2' => [ |
||
184 | 'a3' => 1, |
||
185 | 'b3' => 1, |
||
186 | ], |
||
187 | 'c2' => [ |
||
188 | 'a3' => 1, |
||
189 | 'b3' => 1, |
||
190 | ], |
||
191 | ], |
||
192 | 'b1' => [ |
||
193 | 'a2' => [ |
||
194 | 'a3' => 1, |
||
195 | 'b3' => 1, |
||
196 | ], |
||
197 | 'b2' => [ |
||
198 | 'a3' => 1, |
||
199 | 'b3' => 1, |
||
200 | ], |
||
201 | 'c2' => [ |
||
202 | 'a3' => 1, |
||
203 | 'b3' => 1, |
||
204 | ], |
||
205 | ], |
||
206 | ], |
||
207 | ]); |
||
208 | |||
209 | $tableized = $values->tableize([ |
||
210 | '1st', |
||
211 | '2nd', |
||
212 | '3rd' |
||
213 | ]); |
||
214 | |||
215 | $expected = array ( |
||
216 | 0 => array ( |
||
217 | 'a3' => 1, |
||
218 | 'b3' => 1, |
||
219 | '3rd' => 'a2', |
||
220 | '2nd' => 'a1', |
||
221 | '1st' => 'a', |
||
222 | ), |
||
223 | 1 => array ( |
||
224 | 'a3' => 1, |
||
225 | 'b3' => 1, |
||
226 | '3rd' => 'b2', |
||
227 | '2nd' => 'a1', |
||
228 | '1st' => 'a', |
||
229 | ), |
||
230 | 2 => array ( |
||
231 | 'a3' => 1, |
||
232 | 'b3' => 1, |
||
233 | '3rd' => 'c2', |
||
234 | '2nd' => 'a1', |
||
235 | '1st' => 'a', |
||
236 | ), |
||
237 | 3 => array ( |
||
238 | 'a3' => 1, |
||
239 | 'b3' => 1, |
||
240 | '3rd' => 'a2', |
||
241 | '2nd' => 'b1', |
||
242 | '1st' => 'a', |
||
243 | ), |
||
244 | 4 => array ( |
||
245 | 'a3' => 1, |
||
246 | 'b3' => 1, |
||
247 | '3rd' => 'b2', |
||
248 | '2nd' => 'b1', |
||
249 | '1st' => 'a', |
||
250 | ), |
||
251 | 5 => array ( |
||
252 | 'a3' => 1, |
||
253 | 'b3' => 1, |
||
254 | '3rd' => 'c2', |
||
255 | '2nd' => 'b1', |
||
256 | '1st' => 'a', |
||
257 | ), |
||
258 | 6 => array ( |
||
259 | 'a3' => 1, |
||
260 | 'b3' => 1, |
||
261 | '3rd' => 'a2', |
||
262 | '2nd' => 'a1', |
||
263 | '1st' => 'b', |
||
264 | ), |
||
265 | 7 => array ( |
||
266 | 'a3' => 1, |
||
267 | 'b3' => 1, |
||
268 | '3rd' => 'b2', |
||
269 | '2nd' => 'a1', |
||
270 | '1st' => 'b', |
||
271 | ), |
||
272 | 8 => array ( |
||
273 | 'a3' => 1, |
||
274 | 'b3' => 1, |
||
275 | '3rd' => 'c2', |
||
276 | '2nd' => 'a1', |
||
277 | '1st' => 'b', |
||
278 | ), |
||
279 | 9 => array ( |
||
280 | 'a3' => 1, |
||
281 | 'b3' => 1, |
||
282 | '3rd' => 'a2', |
||
283 | '2nd' => 'b1', |
||
284 | '1st' => 'b', |
||
285 | ), |
||
286 | 10 => array ( |
||
287 | 'a3' => 1, |
||
288 | 'b3' => 1, |
||
289 | '3rd' => 'b2', |
||
290 | '2nd' => 'b1', |
||
291 | '1st' => 'b', |
||
292 | ), |
||
293 | 11 => array ( |
||
294 | 'a3' => 1, |
||
295 | 'b3' => 1, |
||
296 | '3rd' => 'c2', |
||
297 | '2nd' => 'b1', |
||
298 | '1st' => 'b', |
||
299 | ), |
||
300 | ); |
||
301 | |||
302 | if ($expected != $tableized->getArray()) |
||
303 | throw new \Exception("test failed"); |
||
304 | |||
305 | echo 'Helper_Tabe->tableize tested successfully'; |
||
306 | } |
||
540 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths