Type   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 54
Duplicated Lines 0 %

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getGroupsSubmit() 0 6 1
A getForm() 0 3 1
A __construct() 0 8 1
A getGroupsModeration() 0 6 1
A getGroupsRead() 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
use XoopsModules\Adslight\{
28
    Form\TypeForm
29
};
30
31
//$permHelper = new \Xmf\Module\Helper\Permission();
32
33
/**
34
 * Class Type
35
 */
36
class Type extends \XoopsObject
37
{
38
    private $id_type;
0 ignored issues
show
introduced by
The private property $id_type is not used, and could be removed.
Loading history...
39
    private $nom_type;
0 ignored issues
show
introduced by
The private property $nom_type is not used, and could be removed.
Loading history...
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('id_type', \XOBJ_DTYPE_INT);
55
        $this->initVar('nom_type', \XOBJ_DTYPE_TXTBOX);
56
    }
57
58
    /**
59
     * Get form
60
     */
61
    public function getForm(): TypeForm
62
    {
63
        return new TypeForm($this);
64
    }
65
66
    public function getGroupsRead(): ?array
67
    {
68
        //$permHelper = new \Xmf\Module\Helper\Permission();
69
        return $this->permHelper->getGroupsForItem(
70
            'sbcolumns_read',
71
            $this->getVar('id_type')
72
        );
73
    }
74
75
    public function getGroupsSubmit(): ?array
76
    {
77
        //$permHelper = new \Xmf\Module\Helper\Permission();
78
        return $this->permHelper->getGroupsForItem(
79
            'sbcolumns_submit',
80
            $this->getVar('id_type')
81
        );
82
    }
83
84
    public function getGroupsModeration(): ?array
85
    {
86
        //$permHelper = new \Xmf\Module\Helper\Permission();
87
        return $this->permHelper->getGroupsForItem(
88
            'sbcolumns_moderation',
89
            $this->getVar('id_type')
90
        );
91
    }
92
}
93