Code Duplication    Length = 4-4 lines in 2 locations

main/inc/lib/course.lib.php 2 locations

@@ 5077-5080 (lines=4) @@
5074
        $currentUserId = api_get_user_id();
5075
        $restrictedCourses = self::getCatalogueCourseList(true);
5076
        $allowedCoursesToCurrentUser = self::getCatalogueCourseList(true, $currentUserId);
5077
        if (!empty($restrictedCourses)) {
5078
            $visibilityCondition .= ' AND ('.$courseTableAlias.'.code NOT IN ("' . implode('","', $restrictedCourses) . '")';
5079
            $visibilityCondition .= ' OR '.$courseTableAlias.'.code IN ("' . implode('","', $allowedCoursesToCurrentUser) . '"))';
5080
        }
5081
5082
        // Check if course have users denied to see it in the catalogue, then show only if current user is not denied to see it
5083
        $restrictedCourses = self::getCatalogueCourseList(false);
@@ 5085-5088 (lines=4) @@
5082
        // Check if course have users denied to see it in the catalogue, then show only if current user is not denied to see it
5083
        $restrictedCourses = self::getCatalogueCourseList(false);
5084
        $notAllowedCoursesToCurrentUser = self::getCatalogueCourseList(false, $currentUserId);
5085
        if (!empty($restrictedCourses)) {
5086
            $visibilityCondition .= ' AND ('.$courseTableAlias.'.code NOT IN ("' . implode('","', $restrictedCourses) . '")';
5087
            $visibilityCondition .= ' OR '.$courseTableAlias.'.code NOT IN ("' . implode('","', $notAllowedCoursesToCurrentUser) . '"))';
5088
        }
5089
5090
        return $visibilityCondition;
5091
    }