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 $prop_name; |
||
| 11 | public $static; |
||
| 12 | |||
| 13 | function __construct( $path, $line, $class_name, $prop_name, $static ) { |
||
| 14 | $this->class_name = $class_name; |
||
| 15 | $this->prop_name = $prop_name; |
||
| 16 | $this->static = $static; |
||
| 17 | parent::__construct( $path, $line ); |
||
| 18 | } |
||
| 19 | |||
| 20 | View Code Duplication | function to_csv_array() { |
|
| 31 | |||
| 32 | function type() { |
||
| 35 | |||
| 36 | function display_name() { |
||
| 40 | } |