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

@@ 6468-6472 (lines=5) @@
6465
            $sql .= $limitCondition;
6466
        }
6467
6468
        if ($getCount) {
6469
            $result = Database::query($sql);
6470
            $row = Database::fetch_array($result);
6471
6472
            return $row['total'];
6473
        }
6474
        $result = Database::query($sql);
6475

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

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

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

@@ 4479-4483 (lines=5) @@
4476
        if ($getSql) {
4477
            return $sql;
4478
        }
4479
        if ($getCount) {
4480
            $result = Database::query($sql);
4481
            $row = Database::fetch_array($result);
4482
            return $row['count'];
4483
        }
4484
4485
        $orderBy = null;
4486
        if ($getOnlyUserId == false) {