Report::__construct()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 17
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 13
nc 3
nop 1
dl 0
loc 17
rs 9.8333
c 0
b 0
f 0
1
<?php
2
3
namespace XoopsModules\Wfdownloads;
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
 * Wfdownloads module
17
 *
18
 * @copyright       XOOPS Project (https://xoops.org)
19
 * @license         GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html)
20
 * @package         wfdownload
21
 * @since           3.23
22
 * @author          Xoops Development Team
23
 */
24
25
require_once \dirname(__DIR__) . '/include/common.php';
26
27
/**
28
 * Class Report
29
 */
30
class Report extends \XoopsObject
31
{
32
    /**
33
     * @access public
34
     */
35
    public $helper;
36
    public $db;
37
38
    /**
39
     * @param int|null $id
40
     */
41
    public function __construct($id = null)
42
    {
43
        $this->helper = Helper::getInstance();
44
        $this->db     = \XoopsDatabaseFactory::getDatabaseConnection();
45
        $this->initVar('reportid', \XOBJ_DTYPE_INT);
46
        $this->initVar('lid', \XOBJ_DTYPE_INT);
47
        $this->initVar('sender', \XOBJ_DTYPE_INT);
48
        $this->initVar('date', \XOBJ_DTYPE_INT);
49
        $this->initVar('ip', \XOBJ_DTYPE_TXTBOX);
50
        $this->initVar('confirmed', \XOBJ_DTYPE_INT);
51
        $this->initVar('acknowledged', \XOBJ_DTYPE_INT);
52
53
        /** @noinspection UnSafeIsSetOverArrayInspection */
54
        if (isset($id)) {
55
            $item = $this->helper->getHandler('Item')->get($id);
56
            foreach ($item->vars as $k => $v) {
57
                $this->assignVar($k, $v['value']);
58
            }
59
        }
60
    }
61
}
62