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 |
||
| 20 | class TDMDownloads_fielddata extends XoopsObject |
||
| 21 | { |
||
| 22 | // constructor |
||
| 23 | public function __construct() |
||
| 24 | { |
||
| 25 | $this->initVar("iddata",XOBJ_DTYPE_INT,null,false,11); |
||
| 26 | $this->initVar("fid",XOBJ_DTYPE_INT,null,false,11); |
||
| 27 | $this->initVar("lid",XOBJ_DTYPE_INT,null,false,11); |
||
| 28 | $this->initVar("data",XOBJ_DTYPE_TXTBOX, null, false); |
||
| 29 | $this->initVar('dohtml', XOBJ_DTYPE_INT, 1, false); |
||
| 30 | } |
||
| 31 | public function TDMDownloads_fielddata() |
||
| 34 | } |
||
| 35 | } |
||
| 36 | |||
| 44 |