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_modfielddata extends XoopsObject |
||
21 | { |
||
22 | // constructor |
||
23 | public function __construct() |
||
24 | { |
||
25 | $this->initVar("modiddata",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("moddata",XOBJ_DTYPE_TXTAREA, null, false); |
||
29 | $this->initVar('dohtml', XOBJ_DTYPE_INT, 1, false); |
||
30 | } |
||
31 | public function TDMDownloads_modfielddata() |
||
34 | } |
||
35 | } |
||
36 | |||
44 |