Code Duplication    Length = 14-14 lines in 2 locations

class/answer.php 1 location

@@ 614-627 (lines=14) @@
611
     * @param  CriteriaElement $criteria {@link CriteriaElement} to match
612
     * @return int             count of answers
613
     */
614
    public function getCount(CriteriaElement $criteria = null)
615
    {
616
        $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('smartfaq_answers');
617
        if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
618
            $sql .= ' ' . $criteria->renderWhere();
619
        }
620
        $result = $this->db->query($sql);
621
        if (!$result) {
622
            return 0;
623
        }
624
        list($count) = $this->db->fetchRow($result);
625
626
        return $count;
627
    }
628
629
    /**
630
     * count answers matching a condition and group by faq ID

class/category.php 1 location

@@ 540-553 (lines=14) @@
537
     * @param  object $criteria {@link CriteriaElement} to match
538
     * @return int    count of categories
539
     */
540
    public function getCount($criteria = null)
541
    {
542
        $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('smartfaq_categories');
543
        if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
544
            $sql .= ' ' . $criteria->renderWhere();
545
        }
546
        $result = $this->db->query($sql);
547
        if (!$result) {
548
            return 0;
549
        }
550
        list($count) = $this->db->fetchRow($result);
551
552
        return $count;
553
    }
554
555
    /**
556
     * @param  int $parentid