Code Duplication    Length = 13-14 lines in 2 locations

class/category.php 1 location

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

class/faq.php 1 location

@@ 1442-1454 (lines=13) @@
1439
     * @param  object $criteria {@link CriteriaElement}
1440
     * @return bool   FALSE if deletion failed
1441
     */
1442
    public function deleteAll($criteria = null)
1443
    {
1444
        $sql = 'DELETE FROM ' . $this->db->prefix('smartfaq_faq');
1445
        if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
1446
            $sql .= ' ' . $criteria->renderWhere();
1447
        }
1448
        if (!$this->db->query($sql)) {
1449
            return false;
1450
            // TODO : Also delete the permissions related to each FAQ
1451
        }
1452
1453
        return true;
1454
    }
1455
1456
    /**
1457
     * Change a value for FAQ with a certain criteria