Categories   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 77
Duplicated Lines 0 %

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getGroupsModeration() 0 4 1
A getForm() 0 5 1
A getGroupsRead() 0 4 1
A getGroupsSubmit() 0 4 1
A __construct() 0 17 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
 */
23
24
use Xmf\Module\Helper\Permission;
25
use XoopsModules\Adslight\{
26
    Form
27
};
28
29
//$permHelper = new \Xmf\Module\Helper\Permission();
30
31
/**
32
 * Class Categories
33
 */
34
class Categories extends \XoopsObject
35
{
36
    public  $cid;
37
    public  $pid;
38
    public  $title;
39
    public  $cat_desc;
40
    private $cat_keywords;
0 ignored issues
show
introduced by
The private property $cat_keywords is not used, and could be removed.
Loading history...
41
    public  $img;
42
    public  $cat_order;
43
    public  $affprice;
44
    public  $cat_moderate;
45
    public  $moderate_subcat;
46
    public  $helper;
47
    public  $permHelper;
48
49
    /**
50
     * Constructor
51
     *
52
     * @param null
53
     */
54
    public function __construct()
55
    {
56
        parent::__construct();
57
        // /** @var Adslight\Helper $helper */
58
        //        $this->helper = Adslight\Helper::getInstance();
59
        $this->permHelper = new Permission();
60
61
        $this->initVar('cid', \XOBJ_DTYPE_INT);
62
        $this->initVar('pid', \XOBJ_DTYPE_INT);
63
        $this->initVar('title', \XOBJ_DTYPE_TXTBOX);
64
        $this->initVar('cat_desc', \XOBJ_DTYPE_OTHER);
65
        $this->initVar('cat_keywords', \XOBJ_DTYPE_TXTBOX);
66
        $this->initVar('img', \XOBJ_DTYPE_TXTBOX);
67
        $this->initVar('cat_order', \XOBJ_DTYPE_INT);
68
        $this->initVar('affprice', \XOBJ_DTYPE_INT);
69
        $this->initVar('cat_moderate', \XOBJ_DTYPE_INT);
70
        $this->initVar('moderate_subcat', \XOBJ_DTYPE_INT);
71
    }
72
73
    /**
74
     * Get form
75
     *
76
     * @param null
77
     * @return Form\CategoriesForm
78
     */
79
    public function getForm(): Form\CategoriesForm
80
    {
81
        $form = new Form\CategoriesForm($this);
82
83
        return $form;
84
    }
85
86
    /**
87
     * @return array|null
88
     */
89
    public function getGroupsRead(): ?array
90
    {
91
        //$permHelper = new \Xmf\Module\Helper\Permission();
92
        return $this->permHelper->getGroupsForItem('sbcolumns_read', $this->getVar('cid'));
93
    }
94
95
    /**
96
     * @return array|null
97
     */
98
    public function getGroupsSubmit(): ?array
99
    {
100
        //$permHelper = new \Xmf\Module\Helper\Permission();
101
        return $this->permHelper->getGroupsForItem('sbcolumns_submit', $this->getVar('cid'));
102
    }
103
104
    /**
105
     * @return array|null
106
     */
107
    public function getGroupsModeration(): ?array
108
    {
109
        //$permHelper = new \Xmf\Module\Helper\Permission();
110
        return $this->permHelper->getGroupsForItem('sbcolumns_moderation', $this->getVar('cid'));
111
    }
112
}
113