Code Duplication    Length = 13-14 lines in 2 locations

class/category.php 1 location

@@ 660-673 (lines=14) @@
657
     * @param  object $criteria {@link CriteriaElement}
658
     * @return bool   FALSE if deletion failed
659
     */
660
    public function deleteAll($criteria = null)
661
    {
662
        $sql = 'DELETE FROM ' . $this->db->prefix('smartfaq_categories');
663
        if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
664
            $sql .= ' ' . $criteria->renderWhere();
665
        }
666
        if (!$this->db->query($sql)) {
667
            return false;
668
            // TODO : Also delete the permissions related to each FAQ
669
            // TODO : What about sub-categories???
670
        }
671
672
        return true;
673
    }
674
675
    /**
676
     * Change a value for categories with a certain criteria

class/faq.php 1 location

@@ 1454-1466 (lines=13) @@
1451
     * @param  object $criteria {@link CriteriaElement}
1452
     * @return bool   FALSE if deletion failed
1453
     */
1454
    public function deleteAll($criteria = null)
1455
    {
1456
        $sql = 'DELETE FROM ' . $this->db->prefix('smartfaq_faq');
1457
        if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
1458
            $sql .= ' ' . $criteria->renderWhere();
1459
        }
1460
        if (!$this->db->query($sql)) {
1461
            return false;
1462
            // TODO : Also delete the permissions related to each FAQ
1463
        }
1464
1465
        return true;
1466
    }
1467
1468
    /**
1469
     * Change a value for FAQ with a certain criteria