Code Duplication    Length = 18-18 lines in 2 locations

class/faq.php 1 location

@@ 129-146 (lines=18) @@
126
    /**
127
     * @return bool
128
     */
129
    public function checkPermission()
130
    {
131
        require_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

class/category.php 1 location

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