Code Duplication    Length = 13-14 lines in 2 locations

class/CategoryHandler.php 1 location

@@ 435-448 (lines=14) @@
432
     * @param  object $criteria {@link CriteriaElement}
433
     * @return bool   FALSE if deletion failed
434
     */
435
    public function deleteAll($criteria = null)
436
    {
437
        $sql = 'DELETE FROM ' . $this->db->prefix('smartfaq_categories');
438
        if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) {
439
            $sql .= ' ' . $criteria->renderWhere();
440
        }
441
        if (!$this->db->query($sql)) {
442
            return false;
443
            // TODO : Also delete the permissions related to each FAQ
444
            // TODO : What about sub-categories???
445
        }
446
447
        return true;
448
    }
449
450
    /**
451
     * Change a value for categories with a certain criteria

class/FaqHandler.php 1 location

@@ 831-843 (lines=13) @@
828
     * @param  object $criteria {@link CriteriaElement}
829
     * @return bool   FALSE if deletion failed
830
     */
831
    public function deleteAll($criteria = null)
832
    {
833
        $sql = 'DELETE FROM ' . $this->db->prefix('smartfaq_faq');
834
        if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) {
835
            $sql .= ' ' . $criteria->renderWhere();
836
        }
837
        if (!$this->db->query($sql)) {
838
            return false;
839
            // TODO : Also delete the permissions related to each FAQ
840
        }
841
842
        return true;
843
    }
844
845
    /**
846
     * Change a value for FAQ with a certain criteria