Code Duplication    Length = 5-5 lines in 4 locations

main/work/work.lib.php 1 location

@@ 1788-1792 (lines=5) @@
1785
    $direction = in_array(strtolower($direction), array('desc', 'asc')) ? $direction : 'desc';
1786
    $column = Database::escape_string($column);
1787
1788
    if ($getCount) {
1789
        $result = Database::query($sql);
1790
        $result = Database::fetch_array($result);
1791
        return $result['count'];
1792
    }
1793
1794
    $sql .= " ORDER BY $column $direction";
1795
    $sql .= " LIMIT $start, $limit";

main/inc/lib/course.lib.php 1 location

@@ 6454-6458 (lines=5) @@
6451
            $sql .= $limitCondition;
6452
        }
6453
6454
        if ($getCount) {
6455
            $result = Database::query($sql);
6456
            $row = Database::fetch_array($result);
6457
6458
            return $row['total'];
6459
        }
6460
        $result = Database::query($sql);
6461

main/inc/lib/sessionmanager.lib.php 1 location

@@ 3691-3695 (lines=5) @@
3688
		            src.session_id IN ($sessionsSQL)
3689
		            $keywordCondition
3690
		        ";
3691
        if ($getCount) {
3692
            $result = Database::query($sql);
3693
            $row = Database::fetch_array($result, 'ASSOC');
3694
            return $row['count'];
3695
        }
3696
3697
        if (isset($from) && isset($limit)) {
3698
            $from = intval($from);

main/inc/lib/usermanager.lib.php 1 location

@@ 4464-4468 (lines=5) @@
4461
        if ($getSql) {
4462
            return $sql;
4463
        }
4464
        if ($getCount) {
4465
            $result = Database::query($sql);
4466
            $row = Database::fetch_array($result);
4467
            return $row['count'];
4468
        }
4469
4470
        $orderBy = null;
4471
        if ($getOnlyUserId == false) {