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 |
||
| 8 | class Class_Property extends Declaration { |
||
| 9 | public $class_name; |
||
| 10 | public $name; |
||
| 11 | public $static; |
||
| 12 | |||
| 13 | View Code Duplication | function __construct( $path, $line, $class_name, $name, $static ) { |
|
| 19 | |||
| 20 | View Code Duplication | function to_csv_array() { |
|
| 31 | |||
| 32 | function type() { |
||
| 35 | |||
| 36 | function display_name() { |
||
| 40 | } |