Passed
Push — master ( 6af1fb...f5fe55 )
by Michael
02:53 queued 10s
created

Itemvotedata   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 67
Duplicated Lines 0 %

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getGroupsSubmit() 0 6 1
A __construct() 0 12 1
A getForm() 0 3 1
A getGroupsRead() 0 6 1
A getGroupsModeration() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace XoopsModules\Adslight;
6
7
/*
8
 You may not change or alter any portion of this comment or credits
9
 of supporting developers from this source code or any supporting source code
10
 which is considered copyrighted (c) material of the original comment or credit authors.
11
12
 This program is distributed in the hope that it will be useful,
13
 but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15
*/
16
17
/**
18
 * Module: Adslight
19
 *
20
 * @category        Module
21
 * @package         adslight
22
 * @author          XOOPS Development Team <https://xoops.org>
23
 * @copyright       {@link https://xoops.org/ XOOPS Project}
24
 * @license         GPL 2.0 or later
25
 * @link            https://xoops.org/
26
 * @since           1.0.0
27
 */
28
29
use Xmf\Module\Helper\Permission;
30
use XoopsModules\Adslight\Form;
31
use XoopsModules\Adslight\Helper;
32
33
//$permHelper = new \Xmf\Module\Helper\Permission();
34
35
/**
36
 * Class Itemvotedata
37
 */
38
class Itemvotedata extends \XoopsObject
39
{
40
    public $helper;
41
    public $permHelper;
42
43
    /**
44
     * Constructor
45
     *
46
     * @param null
47
     */
48
    public function __construct()
49
    {
50
        parent::__construct();
51
        /** @var Helper $helper */
52
        $this->helper     = Helper::getInstance();
53
        $this->permHelper = new Permission();
54
        $this->initVar('ratingid', \XOBJ_DTYPE_INT);
55
        $this->initVar('lid', \XOBJ_DTYPE_INT);
56
        $this->initVar('ratinguser', \XOBJ_DTYPE_INT);
57
        $this->initVar('rating', \XOBJ_DTYPE_INT);
58
        $this->initVar('ratinghostname', \XOBJ_DTYPE_TXTBOX);
59
        $this->initVar('date_created', \XOBJ_DTYPE_INT);
60
    }
61
62
    /**
63
     * Get form
64
     *
65
     * @return \XoopsModules\Adslight\Form\ItemvotesForm
66
     */
67
    public function getForm(): Form\ItemvotesForm
68
    {
69
        return new Form\ItemvotesForm($this);
70
    }
71
72
    /**
73
     * @return array|null
74
     */
75
    public function getGroupsRead(): ?array
76
    {
77
        //$permHelper = new \Xmf\Module\Helper\Permission();
78
        return $this->permHelper->getGroupsForItem(
79
            'sbcolumns_read',
80
            $this->getVar('ratingid')
81
        );
82
    }
83
84
    /**
85
     * @return array|null
86
     */
87
    public function getGroupsSubmit(): ?array
88
    {
89
        //$permHelper = new \Xmf\Module\Helper\Permission();
90
        return $this->permHelper->getGroupsForItem(
91
            'sbcolumns_submit',
92
            $this->getVar('ratingid')
93
        );
94
    }
95
96
    /**
97
     * @return array|null
98
     */
99
    public function getGroupsModeration(): ?array
100
    {
101
        //$permHelper = new \Xmf\Module\Helper\Permission();
102
        return $this->permHelper->getGroupsForItem(
103
            'sbcolumns_moderation',
104
            $this->getVar('ratingid')
105
        );
106
    }
107
}
108