Code Duplication    Length = 19-19 lines in 2 locations

class/Category.php 1 location

@@ 89-107 (lines=19) @@
86
    /**
87
     * @return bool
88
     */
89
    public function checkPermission()
90
    {
91
//        require_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php';
92
93
        $userIsAdmin = Smartfaq\Utility::userIsAdmin();
94
        if ($userIsAdmin) {
95
            return true;
96
        }
97
98
        /** @var \XoopsModules\Smartfaq\PermissionHandler $smartPermHandler */
99
        $smartPermHandler = \XoopsModules\Smartfaq\Helper::getInstance()->getHandler('Permission');
100
101
        $categoriesGranted = $smartPermHandler->getPermissions('category');
102
        if (in_array($this->categoryid(), $categoriesGranted)) {
103
            $ret = true;
104
        }
105
106
        return $ret;
107
    }
108
109
    /**
110
     * @return mixed

class/Faq.php 1 location

@@ 111-129 (lines=19) @@
108
    /**
109
     * @return bool
110
     */
111
    public function checkPermission()
112
    {
113
//        require_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php';
114
115
        $userIsAdmin = Smartfaq\Utility::userIsAdmin();
116
        if ($userIsAdmin) {
117
            return true;
118
        }
119
        /** @var \XoopsModules\Smartfaq\PermissionHandler $smartPermHandler */
120
        $smartPermHandler = \XoopsModules\Smartfaq\Helper::getInstance()->getHandler('Permission');
121
//        $smartPermHandler = xoops_getModuleHandler('permission', 'smartfaq');
122
123
        $faqsGranted = $smartPermHandler->getPermissions('item');
124
        if (in_array($this->categoryid(), $faqsGranted)) {
125
            $ret = true;
126
        }
127
128
        return $ret;
129
    }
130
131
    /**
132
     * @return array