Code Duplication    Length = 16-18 lines in 2 locations

src/Controller/Admin/Shop/Itemgroupadmin.php 1 location

@@ 235-250 (lines=16) @@
232
     * @param string $iGID
233
     * @return mixed
234
     */
235
    private function admin_getItemgroups($iGID = '')
236
    {
237
        $sql = 'SELECT * FROM itemgroups_base '
238
            . 'LEFT OUTER JOIN itemgroups_text ON itemgroups_base.itmg_id = itemgroups_text.itmgt_pid'
239
            . ' AND itemgroups_text.itmgt_lang = :lang';
240
        if ($iGID != '') $sql .= ' WHERE itmg_id = :gid';
241
        $sql .= ' ORDER BY itmg_no';
242
        $hResult = $this->db->prepare($sql);
243
        $hResult->bindValue(':lang', HelperConfig::$lang);
244
        if ($iGID != '') $hResult->bindValue(':gid', $iGID);
245
        $hResult->execute();
246
247
        $aGroups = $hResult->fetchAll();
248
249
        return $aGroups;
250
    }
251
252
    /**
253
     * @param $aGroups

src/Controller/Admin/Shop/Itemadmin.php 1 location

@@ 402-419 (lines=18) @@
399
     * @param string $iGID
400
     * @return mixed
401
     */
402
    private function admin_getItemgroups($iGID = '') // this function should be outsourced, a duplicate is used in admin itemgroups!
403
    {
404
        $sql = 'SELECT * FROM itemgroups_base'
405
            . ' LEFT OUTER JOIN itemgroups_text ON itemgroups_base.itmg_id = itemgroups_text.itmgt_pid'
406
            . ' AND itemgroups_text.itmgt_lang = :lang';
407
        if ($iGID != '') {
408
            $sql .= ' WHERE itmg_id = :gid';
409
        }
410
        $sql .= ' ORDER BY itmg_no';
411
        $hResult = $this->db->prepare($sql);
412
        $hResult->bindValue(':lang', HelperConfig::$lang);
413
        if ($iGID != '') {
414
            $hResult->bindValue(':gid', $iGID);
415
        }
416
        $hResult->execute();
417
418
        return $hResult->fetchAll();
419
    }
420
421
}