Code Duplication    Length = 8-9 lines in 3 locations

class/SmartPersistableObjectHandler.php 3 locations

@@ 369-376 (lines=8) @@
366
            $sql = 'SELECT * FROM ' . $this->table . ' AS ' . $this->_itemname;
367
        }
368
369
        if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) {
370
            $sql .= ' ' . $criteria->renderWhere();
371
            if ('' !== $criteria->getSort()) {
372
                $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
373
            }
374
            $limit = $criteria->getLimit();
375
            $start = $criteria->getStart();
376
        }
377
        if ($debug) {
378
            xoops_debug($sql);
379
        }
@@ 400-408 (lines=9) @@
397
    {
398
        $ret = [];
399
400
        if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) {
401
            $sql .= ' ' . $criteria->renderWhere();
402
            if ($criteria->groupby) {
403
                $sql .= $criteria->getGroupby();
404
            }
405
            if ('' !== $criteria->getSort()) {
406
                $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
407
            }
408
        }
409
        if ($debug) {
410
            xoops_debug($sql);
411
        }
@@ 538-545 (lines=8) @@
535
            $sql .= ', ' . $this->getIdentifierName();
536
        }
537
        $sql .= ' FROM ' . $this->table . ' AS ' . $this->_itemname;
538
        if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) {
539
            $sql .= ' ' . $criteria->renderWhere();
540
            if ('' !== $criteria->getSort()) {
541
                $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder();
542
            }
543
            $limit = $criteria->getLimit();
544
            $start = $criteria->getStart();
545
        }
546
547
        if ($debug) {
548
            xoops_debug($sql);