Passed
Pull Request — master (#4)
by Michael
02:50
created

TDMDownloads_downlimit   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 16
loc 16
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A TDMDownloads_downlimit() 0 3 1

How to fix   Duplicated Code   

Duplicated Code

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
2
/**
3
 * TDMDownload
4
 *
5
 * You may not change or alter any portion of this comment or credits
6
 * of supporting developers from this source code or any supporting source code
7
 * which is considered copyrighted (c) material of the original comment or credit authors.
8
 * This program is distributed in the hope that it will be useful,
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
 *
12
 * @copyright   Gregory Mage (Aka Mage) and Hossein Azizabadi (Aka voltan)
13
 * @license     GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
14
 * @author      Gregory Mage (Aka Mage) and Hossein Azizabadi (Aka voltan)
15
 */
16
17
if (!defined("XOOPS_ROOT_PATH")) {
18
    die("XOOPS root path not defined");
19
}
20
21
class TDMDownloads_downlimit extends XoopsObject
22
{
23
// constructor
24
    public function __construct()
25
    {
26
        $this->initVar("downlimit_id",XOBJ_DTYPE_INT,null,false,11);
27
        $this->initVar("downlimit_lid",XOBJ_DTYPE_INT,null,false,11);
28
        $this->initVar("downlimit_uid",XOBJ_DTYPE_INT,null,false,11);
29
        $this->initVar("downlimit_hostname",XOBJ_DTYPE_TXTBOX, null, false);
30
        $this->initVar("downlimit_date",XOBJ_DTYPE_INT,null,false,10);
31
    }
32
    function TDMDownloads_downlimit()
0 ignored issues
show
Best Practice introduced by
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
33
    {
34
        $this->__construct();
35
    }
36
}
37
38
class TDMDownloadstdmdownloads_downlimitHandler extends XoopsPersistableObjectHandler
39
{
40
    public function __construct(&$db)
41
    {
42
        parent::__construct($db, "tdmdownloads_downlimit", 'tdmdownloads_downlimit', 'downlimit_id', 'downlimit_lid');
43
    }
44
}
45