Code Duplication    Length = 14-14 lines in 2 locations

class/answer.php 1 location

@@ 664-677 (lines=14) @@
661
     * @param  CriteriaElement $criteria {@link CriteriaElement} to match
662
     * @return int             count of answers
663
     */
664
    public function getCount(CriteriaElement $criteria = null)
665
    {
666
        $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('smartfaq_answers');
667
        if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
668
            $sql .= ' ' . $criteria->renderWhere();
669
        }
670
        $result = $this->db->query($sql);
671
        if (!$result) {
672
            return 0;
673
        }
674
        list($count) = $this->db->fetchRow($result);
675
676
        return $count;
677
    }
678
679
    /**
680
     * count answers matching a condition and group by faq ID

class/category.php 1 location

@@ 557-570 (lines=14) @@
554
     * @param  object $criteria {@link CriteriaElement} to match
555
     * @return int    count of categories
556
     */
557
    public function getCount($criteria = null)
558
    {
559
        $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('smartfaq_categories');
560
        if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
561
            $sql .= ' ' . $criteria->renderWhere();
562
        }
563
        $result = $this->db->query($sql);
564
        if (!$result) {
565
            return 0;
566
        }
567
        list($count) = $this->db->fetchRow($result);
568
569
        return $count;
570
    }
571
572
    /**
573
     * @param  int $parentid