Completed
Pull Request — master (#27)
by Michael
01:42
created

TaskHandler   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 10 10 2

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
namespace XoopsModules\Xnewsletter;
4
5
/*
6
 You may not change or alter any portion of this comment or credits
7
 of supporting developers from this source code or any supporting source code
8
 which is considered copyrighted (c) material of the original comment or credit authors.
9
10
 This program is distributed in the hope that it will be useful,
11
 but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
*/
14
15
/**
16
 * xnewsletter module for xoops
17
 *
18
 * @copyright       The TXMod XOOPS Project http://sourceforge.net/projects/thmod/
19
 * @copyright       XOOPS Project (https://xoops.org)
20
 * @license         GPL 2.0 or later
21
 * @package         xnewsletter
22
 * @since           2.5.x
23
 * @author          XOOPS Development Team ( [email protected] ) - ( https://xoops.org )
24
 */
25
26
//use XoopsModules\Xnewsletter;
27
28
// defined("XOOPS_ROOT_PATH") || die("XOOPS root path not defined");
29
require_once dirname(__DIR__) . '/include/common.php';
30
31
/**
32
 * Class TaskHandler
33
 */
34 View Code Duplication
class TaskHandler extends \XoopsPersistableObjectHandler
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
35
{
36
    /**
37
     * @var Helper
38
     * @access public
39
     */
40
    public $helper = null;
41
42
    /**
43
     * @param null|\XoopsDatabase                   $db
44
     * @param \XoopsModules\Xnewsletter\Helper|null $helper
45
     */
46
    public function __construct(\XoopsDatabase $db = null, Helper $helper = null)
47
    {
48
        parent::__construct($db, 'xnewsletter_task', Task::class, 'task_id', 'task_letter_id');
49
        /** @var Helper $this->helper */
50
        if (null === $helper) {
51
            $this->helper = Helper::getInstance();
52
        } else {
53
            $this->helper = $helper;
54
        }
55
    }
56
}
57