Uservotedata   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 73
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
eloc 28
c 1
b 0
f 0
dl 0
loc 73
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getGroupsRead() 0 6 1
A getForm() 0 3 1
A getGroupsModeration() 0 6 1
A __construct() 0 12 1
A getGroupsSubmit() 0 6 1
1
<?php declare(strict_types=1);
2
3
namespace XoopsModules\Adslight;
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
 * Module: Adslight
17
 *
18
 * @category        Module
19
 * @author          XOOPS Development Team <https://xoops.org>
20
 * @copyright       {@link https://xoops.org/ XOOPS Project}
21
 * @license         GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html)
22
 * @link            https://xoops.org/
23
 * @since           1.0.0
24
 */
25
26
use Xmf\Module\Helper\Permission;
27
28
//$permHelper = new \Xmf\Module\Helper\Permission();
29
30
/**
31
 * Class Uservotedata
32
 */
33
class Uservotedata extends \XoopsObject
34
{
35
    private $ratingid;
0 ignored issues
show
introduced by
The private property $ratingid is not used, and could be removed.
Loading history...
36
    private $usid;
0 ignored issues
show
introduced by
The private property $usid is not used, and could be removed.
Loading history...
37
    private $ratinguser;
0 ignored issues
show
introduced by
The private property $ratinguser is not used, and could be removed.
Loading history...
38
    private $rating;
0 ignored issues
show
introduced by
The private property $rating is not used, and could be removed.
Loading history...
39
    private $ratinghostname;
0 ignored issues
show
introduced by
The private property $ratinghostname is not used, and could be removed.
Loading history...
40
    private $date_created;
0 ignored issues
show
introduced by
The private property $date_created is not used, and could be removed.
Loading history...
41
    public  $helper;
42
    public $permHelper;
43
44
    /**
45
     * Constructor
46
     *
47
     * @param null
48
     */
49
    public function __construct()
50
    {
51
        parent::__construct();
52
        /** @var Helper $helper */
53
        $this->helper     = Helper::getInstance();
54
        $this->permHelper = new Permission();
55
        $this->initVar('ratingid', \XOBJ_DTYPE_INT);
56
        $this->initVar('usid', \XOBJ_DTYPE_INT);
57
        $this->initVar('ratinguser', \XOBJ_DTYPE_INT);
58
        $this->initVar('rating', \XOBJ_DTYPE_INT);
59
        $this->initVar('ratinghostname', \XOBJ_DTYPE_TXTBOX);
60
        $this->initVar('date_created', \XOBJ_DTYPE_INT);
61
    }
62
63
    /**
64
     * Get form
65
     *
66
     * @return \XoopsModules\Adslight\Form\UservotesForm
67
     */
68
    public function getForm(): Form\UservotesForm
69
    {
70
        return new Form\UservotesForm($this);
71
    }
72
73
    /**
74
     * @return array|null
75
     */
76
    public function getGroupsRead(): ?array
77
    {
78
        //$permHelper = new \Xmf\Module\Helper\Permission();
79
        return $this->permHelper->getGroupsForItem(
80
            'sbcolumns_read',
81
            $this->getVar('ratingid')
82
        );
83
    }
84
85
    /**
86
     * @return array|null
87
     */
88
    public function getGroupsSubmit(): ?array
89
    {
90
        //$permHelper = new \Xmf\Module\Helper\Permission();
91
        return $this->permHelper->getGroupsForItem(
92
            'sbcolumns_submit',
93
            $this->getVar('ratingid')
94
        );
95
    }
96
97
    /**
98
     * @return array|null
99
     */
100
    public function getGroupsModeration(): ?array
101
    {
102
        //$permHelper = new \Xmf\Module\Helper\Permission();
103
        return $this->permHelper->getGroupsForItem(
104
            'sbcolumns_moderation',
105
            $this->getVar('ratingid')
106
        );
107
    }
108
}
109