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 |
||
| 23 | class ExtcalFormRRuleCheckBox extends XoopsFormCheckBox |
||
|
|
|||
| 24 | { |
||
| 25 | /** |
||
| 26 | * @param $caption |
||
| 27 | * @param $name |
||
| 28 | * @param null $value |
||
| 29 | */ |
||
| 30 | public function __construct($caption, $name, $value = null) |
||
| 34 | |||
| 35 | /** |
||
| 36 | * prepare HTML for output. |
||
| 37 | * |
||
| 38 | * @return string |
||
| 39 | */ |
||
| 40 | public function render() |
||
| 62 | } |
||
| 63 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.