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

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