Conditions | 2 |
Paths | 2 |
Total Lines | 160 |
Code Lines | 100 |
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 |
||
376 | public static function test_piramidize() |
||
377 | { |
||
378 | $values = new Helper_Table([ |
||
379 | 'a' => [ |
||
380 | 'a1' => [ |
||
381 | 'a2' => [ |
||
382 | 'a3' => 1, |
||
383 | 'b3' => 1, |
||
384 | ], |
||
385 | 'b2' => [ |
||
386 | 'a3' => 2, |
||
387 | 'b3' => 2, |
||
388 | ], |
||
389 | 'c2' => [ |
||
390 | 'a3' => 3, |
||
391 | 'b3' => 3, |
||
392 | ], |
||
393 | ], |
||
394 | 'b1' => [ |
||
395 | 'a2' => [ |
||
396 | 'a3' => 1, |
||
397 | 'b3' => 1, |
||
398 | ], |
||
399 | 'b2' => [ |
||
400 | 'a3' => 2, |
||
401 | 'b3' => 2, |
||
402 | ], |
||
403 | 'c2' => [ |
||
404 | 'a3' => 3, |
||
405 | 'b3' => 3, |
||
406 | ], |
||
407 | ], |
||
408 | ], |
||
409 | 'b' => [ |
||
410 | 'a1' => [ |
||
411 | 'a2' => [ |
||
412 | 'a3' => 1, |
||
413 | 'b3' => 1, |
||
414 | ], |
||
415 | 'b2' => [ |
||
416 | 'a3' => 2, |
||
417 | 'b3' => 2, |
||
418 | ], |
||
419 | 'c2' => [ |
||
420 | 'a3' => 3, |
||
421 | 'b3' => 3, |
||
422 | ], |
||
423 | ], |
||
424 | 'b1' => [ |
||
425 | 'a2' => [ |
||
426 | 'a3' => 1, |
||
427 | 'b3' => 1, |
||
428 | ], |
||
429 | 'b2' => [ |
||
430 | 'a3' => 2, |
||
431 | 'b3' => 2, |
||
432 | ], |
||
433 | 'c2' => [ |
||
434 | 'a3' => 3, |
||
435 | 'b3' => 3, |
||
436 | ], |
||
437 | ], |
||
438 | ], |
||
439 | ]); |
||
440 | |||
441 | // $values->dumpJson(); |
||
442 | |||
443 | $values->tableize([ |
||
444 | '1st', |
||
445 | '2nd', |
||
446 | '3rd', |
||
447 | ]); |
||
448 | |||
449 | // $values->dumpJson( |
||
450 | // true |
||
451 | // ); |
||
452 | |||
453 | $values->piramidize([ |
||
454 | '3rd', |
||
455 | '2nd', |
||
456 | '1st', |
||
457 | ]); |
||
458 | |||
459 | $expected = array ( |
||
460 | 'a2' => array ( |
||
461 | 'a1' => array ( |
||
462 | 'a' => array ( |
||
463 | 'a3' => 1, |
||
464 | 'b3' => 1, |
||
465 | ), |
||
466 | 'b' => array ( |
||
467 | 'a3' => 1, |
||
468 | 'b3' => 1, |
||
469 | ), |
||
470 | ), |
||
471 | 'b1' => array ( |
||
472 | 'a' => array ( |
||
473 | 'a3' => 1, |
||
474 | 'b3' => 1, |
||
475 | ), |
||
476 | 'b' => array ( |
||
477 | 'a3' => 1, |
||
478 | 'b3' => 1, |
||
479 | ), |
||
480 | ), |
||
481 | ), |
||
482 | 'b2' => array ( |
||
483 | 'a1' => array ( |
||
484 | 'a' => array ( |
||
485 | 'a3' => 2, |
||
486 | 'b3' => 2, |
||
487 | ), |
||
488 | 'b' => array ( |
||
489 | 'a3' => 2, |
||
490 | 'b3' => 2, |
||
491 | ), |
||
492 | ), |
||
493 | 'b1' => array ( |
||
494 | 'a' => array ( |
||
495 | 'a3' => 2, |
||
496 | 'b3' => 2, |
||
497 | ), |
||
498 | 'b' => array ( |
||
499 | 'a3' => 2, |
||
500 | 'b3' => 2, |
||
501 | ), |
||
502 | ), |
||
503 | ), |
||
504 | 'c2' => array ( |
||
505 | 'a1' => array ( |
||
506 | 'a' => array ( |
||
507 | 'a3' => 3, |
||
508 | 'b3' => 3, |
||
509 | ), |
||
510 | 'b' => array ( |
||
511 | 'a3' => 3, |
||
512 | 'b3' => 3, |
||
513 | ), |
||
514 | ), |
||
515 | 'b1' => array ( |
||
516 | 'a' => array ( |
||
517 | 'a3' => 3, |
||
518 | 'b3' => 3, |
||
519 | ), |
||
520 | 'b' => array ( |
||
521 | 'a3' => 3, |
||
522 | 'b3' => 3, |
||
523 | ), |
||
524 | ), |
||
525 | ), |
||
526 | ); |
||
527 | |||
528 | |||
529 | // echo var_export($values->getArray()); |
||
530 | // $values->dumpJson(true); |
||
531 | |||
532 | if ($expected != $values->getArray()) |
||
533 | throw new \Exception("test failed"); |
||
534 | |||
535 | echo 'Helper_Tabe->piramidize tested successfully'; |
||
536 | } |
||
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