Code Duplication    Length = 13-14 lines in 2 locations

class/baseObjectHandler.php 1 location

@@ 191-203 (lines=13) @@
188
     * @return int    count of objects
189
     * @access public
190
     */
191
    public function getCount($criteria = null)
192
    {
193
        $sql = 'SELECT COUNT(*) FROM ' . $this->_db->prefix($this->_dbtable);
194
        if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
195
            $sql .= ' ' . $criteria->renderWhere();
196
        }
197
        if (!$result = $this->_db->query($sql)) {
198
            return 0;
199
        }
200
        list($count) = $this->_db->fetchRow($result);
201
202
        return $count;
203
    }
204
205
    /**
206
     * delete object based on id

class/file.php 1 location

@@ 656-669 (lines=14) @@
653
     * @param  object $criteria {@link CriteriaElement} to match
654
     * @return int    count of files
655
     */
656
    public function getCount($criteria = null)
657
    {
658
        $sql = 'SELECT COUNT(*) FROM ' . $this->db->prefix('smartpartner_files');
659
        if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
660
            $sql .= ' ' . $criteria->renderWhere();
661
        }
662
        $result = $this->db->query($sql);
663
        if (!$result) {
664
            return 0;
665
        }
666
        list($count) = $this->db->fetchRow($result);
667
668
        return $count;
669
    }
670
671
    /**
672
     * delete files matching a set of conditions