Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
| 1 | <? |
||
| 5 | View Code Duplication | final class DistanceCollector extends Collector |
|
| 6 | { |
||
| 7 | |||
| 8 | public static function getMissingDistances() |
||
| 13 | |||
| 14 | public static function getRow($id) |
||
| 19 | |||
| 20 | public static function getDistanceByFields($date, $type, $distance) |
||
| 27 | |||
| 28 | } |
Short opening tags are disabled in PHP’s default configuration. In such a case, all content of this file is output verbatim to the browser without being parsed, or executed.
As a precaution to avoid these problems better use the long opening tag
<?php.