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 |
||
| 10 | class Select_Field extends Predefined_Options_Field { |
||
| 11 | /** |
||
| 12 | * {@inheritDoc} |
||
| 13 | */ |
||
| 14 | public function set_value_from_input( $input ) { |
||
| 32 | |||
| 33 | /** |
||
| 34 | * {@inheritDoc} |
||
| 35 | */ |
||
| 36 | View Code Duplication | public function to_json( $load ) { |
|
| 49 | |||
| 50 | /** |
||
| 51 | * {@inheritDoc} |
||
| 52 | */ |
||
| 53 | public function get_formatted_value() { |
||
| 65 | } |
||
| 66 |