Code Duplication    Length = 8-8 lines in 4 locations

class/object.php 2 locations

@@ 135-142 (lines=8) @@
132
        $ret   = array();
133
        $limit = $start = 0;
134
        $sql   = 'SELECT * FROM ' . $this->table;
135
        if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
136
            $sql .= ' ' . $criteria->renderWhere();
137
            if ($criteria->getSort() != '') {
138
                $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
139
            }
140
            $limit = $criteria->getLimit();
141
            $start = $criteria->getStart();
142
        }
143
        $result = $this->db->query($sql, $limit, $start);
144
        if (!$result) {
145
            return $ret;
@@ 220-227 (lines=8) @@
217
            $sql .= ', ' . $this->identifierName;
218
        }
219
        $sql .= ' FROM ' . $this->table;
220
        if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
221
            $sql .= ' ' . $criteria->renderWhere();
222
            if ($criteria->getSort() != '') {
223
                $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
224
            }
225
            $limit = $criteria->getLimit();
226
            $start = $criteria->getStart();
227
        }
228
        $result = $this->db->query($sql, $limit, $start);
229
        if (!$result) {
230
            return $ret;

class/file.php 1 location

@@ 576-583 (lines=8) @@
573
        $ret   = array();
574
        $limit = $start = 0;
575
        $sql   = 'SELECT * FROM ' . $this->db->prefix('smartpartner_files');
576
        if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
577
            $sql .= ' ' . $criteria->renderWhere();
578
            if ($criteria->getSort() != '') {
579
                $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
580
            }
581
            $limit = $criteria->getLimit();
582
            $start = $criteria->getStart();
583
        }
584
        //echo "<br>" . $sql . "<br>";
585
        $result = $this->db->query($sql, $limit, $start);
586
        if (!$result) {

class/partner.php 1 location

@@ 983-990 (lines=8) @@
980
        if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
981
            $whereClause = $criteria->renderWhere();
982
983
            if ($whereClause !== 'WHERE ()') {
984
                $sql .= ' ' . $criteria->renderWhere();
985
                if ($criteria->getSort() != '') {
986
                    $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
987
                }
988
                $limit = $criteria->getLimit();
989
                $start = $criteria->getStart();
990
            }
991
        }
992
993
        //echo "<br>" . $sql . "<br>";exit;