IpLog   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 25
rs 10
c 0
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 15 3
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
use XoopsModules\Wfdownloads;
26
27
require_once \dirname(__DIR__) . '/include/common.php';
28
29
/**
30
 * Class IP_Log
31
 */
32
class IpLog extends \XoopsObject
33
{
34
    /**
35
     * @access public
36
     */
37
    public $helper;
38
39
    /**
40
     * @param int|null $id
41
     */
42
    public function __construct($id = null)
43
    {
44
        /** @var \XoopsModules\Wfdownloads\Helper $this ->helper */
45
        $this->helper = Helper::getInstance();
0 ignored issues
show
Bug introduced by
The property helper does not seem to exist on XoopsModules\Wfdownloads\Helper.
Loading history...
46
        $this->db     = \XoopsDatabaseFactory::getDatabaseConnection();
0 ignored issues
show
Bug introduced by
The property db does not seem to exist on XoopsModules\Wfdownloads\Helper.
Loading history...
47
        $this->initVar('ip_logid', \XOBJ_DTYPE_INT);
0 ignored issues
show
Bug introduced by
The method initVar() does not exist on XoopsModules\Wfdownloads\Helper. Did you maybe mean init()? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

47
        $this->/** @scrutinizer ignore-call */ 
48
               initVar('ip_logid', \XOBJ_DTYPE_INT);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
48
        $this->initVar('ip_address', \XOBJ_DTYPE_TXTBOX);
49
        $this->initVar('date', \XOBJ_DTYPE_INT);
50
        $this->initVar('lid', \XOBJ_DTYPE_INT);
51
        $this->initVar('uid', \XOBJ_DTYPE_INT);
52
53
        if (null !== $id) {
54
            $item = $this->helper->getHandler('Item')->get($id);
55
            foreach ($item->vars as $k => $v) {
56
                $this->assignVar($k, $v['value']);
0 ignored issues
show
Bug introduced by
The method assignVar() does not exist on XoopsModules\Wfdownloads\Helper. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

56
                $this->/** @scrutinizer ignore-call */ 
57
                       assignVar($k, $v['value']);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
57
            }
58
        }
59
    }
60
}
61