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 | <?php |
||
| 14 | View Code Duplication | class Value extends \Model |
|
| 15 | { |
||
| 16 | public static $cols = [ |
||
| 17 | 'origianl' => ['type' => 'textarea'], |
||
| 18 | 'replace' => ['type' => 'textarea'], |
||
| 19 | 'param_id' => ['type' => 'select', 'source' => 'relation', 'relation' => 'param'], |
||
| 20 | 'date_create' => ['type' => 'dateTime'], |
||
| 21 | ]; |
||
| 22 | |||
| 23 | public static function relations() |
||
| 32 | |||
| 33 | } |
||
| 34 |