Code Duplication    Length = 13-14 lines in 2 locations

class/category.php 1 location

@@ 643-656 (lines=14) @@
640
     * @param  object $criteria {@link CriteriaElement}
641
     * @return bool   FALSE if deletion failed
642
     */
643
    public function deleteAll($criteria = null)
644
    {
645
        $sql = 'DELETE FROM ' . $this->db->prefix('smartfaq_categories');
646
        if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
647
            $sql .= ' ' . $criteria->renderWhere();
648
        }
649
        if (!$this->db->query($sql)) {
650
            return false;
651
            // TODO : Also delete the permissions related to each FAQ
652
            // TODO : What about sub-categories???
653
        }
654
655
        return true;
656
    }
657
658
    /**
659
     * Change a value for categories with a certain criteria

class/faq.php 1 location

@@ 1415-1427 (lines=13) @@
1412
     * @param  object $criteria {@link CriteriaElement}
1413
     * @return bool   FALSE if deletion failed
1414
     */
1415
    public function deleteAll($criteria = null)
1416
    {
1417
        $sql = 'DELETE FROM ' . $this->db->prefix('smartfaq_faq');
1418
        if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
1419
            $sql .= ' ' . $criteria->renderWhere();
1420
        }
1421
        if (!$this->db->query($sql)) {
1422
            return false;
1423
            // TODO : Also delete the permissions related to each FAQ
1424
        }
1425
1426
        return true;
1427
    }
1428
1429
    /**
1430
     * Change a value for FAQ with a certain criteria