Code Duplication    Length = 4-4 lines in 2 locations

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

@@ 5044-5047 (lines=4) @@
5041
        $currentUserId = api_get_user_id();
5042
        $restrictedCourses = self::getCatalogueCourseList(true);
5043
        $allowedCoursesToCurrentUser = self::getCatalogueCourseList(true, $currentUserId);
5044
        if (!empty($restrictedCourses)) {
5045
            $visibilityCondition .= ' AND ('.$courseTableAlias.'.code NOT IN ("' . implode('","', $restrictedCourses) . '")';
5046
            $visibilityCondition .= ' OR '.$courseTableAlias.'.code IN ("' . implode('","', $allowedCoursesToCurrentUser) . '"))';
5047
        }
5048
5049
        // Check if course have users denied to see it in the catalogue, then show only if current user is not denied to see it
5050
        $restrictedCourses = self::getCatalogueCourseList(false);
@@ 5052-5055 (lines=4) @@
5049
        // Check if course have users denied to see it in the catalogue, then show only if current user is not denied to see it
5050
        $restrictedCourses = self::getCatalogueCourseList(false);
5051
        $notAllowedCoursesToCurrentUser = self::getCatalogueCourseList(false, $currentUserId);
5052
        if (!empty($restrictedCourses)) {
5053
            $visibilityCondition .= ' AND ('.$courseTableAlias.'.code NOT IN ("' . implode('","', $restrictedCourses) . '")';
5054
            $visibilityCondition .= ' OR '.$courseTableAlias.'.code NOT IN ("' . implode('","', $notAllowedCoursesToCurrentUser) . '"))';
5055
        }
5056
5057
        return $visibilityCondition;
5058
    }