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_number |
||
9 | extends AbstractComponent |
||
|
|||
10 | implements ValueComponentInterface, |
||
11 | DisableableComponentInterface, |
||
12 | FilterableComponentInterface, |
||
13 | ValidatableComponentInterface |
||
14 | { |
||
15 | public $component_type = 'number'; |
||
16 | |||
17 | public function default_model() |
||
35 | |||
36 | public function filter($v) |
||
40 | |||
41 | public function validation($v,&$e) |
||
58 | |||
59 | public function required_arguments() |
||
63 | |||
64 | public function get_template_path() |
||
68 | } |