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 namespace XoopsModules\Extcal\Form; |
||
23 | class FormFileCheckBox extends \XoopsFormCheckBox |
||
24 | { |
||
25 | /** |
||
26 | * @param $caption |
||
27 | * @param $name |
||
28 | * @param null $value |
||
29 | * |
||
30 | * @return FormFileCheckBox |
||
|
|||
31 | */ |
||
32 | public function __construct($caption, $name, $value = null) |
||
36 | |||
37 | /** |
||
38 | * prepare HTML for output. |
||
39 | * |
||
40 | * @return string |
||
41 | */ |
||
42 | public function render() |
||
57 | } |
||
58 |
Adding a
@return
annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.Please refer to the PHP core documentation on constructors.