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 Component_code |
||
| 9 | extends AbstractComponent |
||
|
|
|||
| 10 | implements ValueComponentInterface, |
||
| 11 | DisableableComponentInterface, |
||
| 12 | FilterableComponentInterface, |
||
| 13 | ValidatableComponentInterface |
||
| 14 | { |
||
| 15 | public $component_type = 'code'; |
||
| 16 | |||
| 17 | View Code Duplication | public function default_model() |
|
| 32 | |||
| 33 | public function required_arguments() |
||
| 37 | |||
| 38 | public function get_template_path() |
||
| 42 | |||
| 43 | public function enqueue_scripts() |
||
| 48 | } |