Code Duplication    Length = 29-29 lines in 2 locations

htdocs/kernel/comment.php 1 location

@@ 446-474 (lines=29) @@
443
     *
444
     * @return array Array of {@link XoopsComment} objects
445
     **/
446
    public function getObjects(CriteriaElement $criteria = null, $id_as_key = false)
447
    {
448
        $ret   = array();
449
        $limit = $start = 0;
450
        $sql   = 'SELECT * FROM ' . $this->db->prefix('xoopscomments');
451
        if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
452
            $sql .= ' ' . $criteria->renderWhere();
453
            $sort = ($criteria->getSort() != '') ? $criteria->getSort() : 'com_id';
454
            $sql .= ' ORDER BY ' . $sort . ' ' . $criteria->getOrder();
455
            $limit = $criteria->getLimit();
456
            $start = $criteria->getStart();
457
        }
458
        $result = $this->db->query($sql, $limit, $start);
459
        if (!$result) {
460
            return $ret;
461
        }
462
        while ($myrow = $this->db->fetchArray($result)) {
463
            $comment = new XoopsComment();
464
            $comment->assignVars($myrow);
465
            if (!$id_as_key) {
466
                $ret[] =& $comment;
467
            } else {
468
                $ret[$myrow['com_id']] = &$comment;
469
            }
470
            unset($comment);
471
        }
472
473
        return $ret;
474
    }
475
476
    /**
477
     * Count Comments

htdocs/kernel/notification.php 1 location

@@ 338-366 (lines=29) @@
335
     *
336
     * @return array Array of {@link XoopsNotification} objects
337
     **/
338
    public function getObjects(CriteriaElement $criteria = null, $id_as_key = false)
339
    {
340
        $ret   = array();
341
        $limit = $start = 0;
342
        $sql   = 'SELECT * FROM ' . $this->db->prefix('xoopsnotifications');
343
        if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) {
344
            $sql .= ' ' . $criteria->renderWhere();
345
            $sort = ($criteria->getSort() != '') ? $criteria->getSort() : 'not_id';
346
            $sql .= ' ORDER BY ' . $sort . ' ' . $criteria->getOrder();
347
            $limit = $criteria->getLimit();
348
            $start = $criteria->getStart();
349
        }
350
        $result = $this->db->query($sql, $limit, $start);
351
        if (!$result) {
352
            return $ret;
353
        }
354
        while ($myrow = $this->db->fetchArray($result)) {
355
            $notification = new XoopsNotification();
356
            $notification->assignVars($myrow);
357
            if (!$id_as_key) {
358
                $ret[] =& $notification;
359
            } else {
360
                $ret[$myrow['not_id']] =& $notification;
361
            }
362
            unset($notification);
363
        }
364
365
        return $ret;
366
    }
367
368
    // TODO: Need this??
369
    /**