Code Duplication    Length = 18-18 lines in 2 locations

class/category.php 1 location

@@ 81-98 (lines=18) @@
78
    /**
79
     * @return bool
80
     */
81
    public function checkPermission()
82
    {
83
        include_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php';
84
85
        $userIsAdmin = sf_userIsAdmin();
86
        if ($userIsAdmin) {
87
            return true;
88
        }
89
90
        $smartPermHandler = xoops_getModuleHandler('permission', 'smartfaq');
91
92
        $categoriesGranted = $smartPermHandler->getPermissions('category');
93
        if (in_array($this->categoryid(), $categoriesGranted)) {
94
            $ret = true;
95
        }
96
97
        return $ret;
98
    }
99
100
    /**
101
     * @return mixed

class/faq.php 1 location

@@ 129-146 (lines=18) @@
126
    /**
127
     * @return bool
128
     */
129
    public function checkPermission()
130
    {
131
        include_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php';
132
133
        $userIsAdmin = sf_userIsAdmin();
134
        if ($userIsAdmin) {
135
            return true;
136
        }
137
138
        $smartPermHandler = xoops_getModuleHandler('permission', 'smartfaq');
139
140
        $faqsGranted = $smartPermHandler->getPermissions('item');
141
        if (in_array($this->categoryid(), $faqsGranted)) {
142
            $ret = true;
143
        }
144
145
        return $ret;
146
    }
147
148
    /**
149
     * @return array