Code Duplication    Length = 4-4 lines in 2 locations

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

@@ 5106-5109 (lines=4) @@
5103
        $currentUserId = api_get_user_id();
5104
        $restrictedCourses = self::getCatalogueCourseList(true);
5105
        $allowedCoursesToCurrentUser = self::getCatalogueCourseList(true, $currentUserId);
5106
        if (!empty($restrictedCourses)) {
5107
            $visibilityCondition .= ' AND ('.$courseTableAlias.'.code NOT IN ("' . implode('","', $restrictedCourses) . '")';
5108
            $visibilityCondition .= ' OR '.$courseTableAlias.'.code IN ("' . implode('","', $allowedCoursesToCurrentUser) . '"))';
5109
        }
5110
5111
        // Check if course have users denied to see it in the catalogue, then show only if current user is not denied to see it
5112
        $restrictedCourses = self::getCatalogueCourseList(false);
@@ 5114-5117 (lines=4) @@
5111
        // Check if course have users denied to see it in the catalogue, then show only if current user is not denied to see it
5112
        $restrictedCourses = self::getCatalogueCourseList(false);
5113
        $notAllowedCoursesToCurrentUser = self::getCatalogueCourseList(false, $currentUserId);
5114
        if (!empty($restrictedCourses)) {
5115
            $visibilityCondition .= ' AND ('.$courseTableAlias.'.code NOT IN ("' . implode('","', $restrictedCourses) . '")';
5116
            $visibilityCondition .= ' OR '.$courseTableAlias.'.code NOT IN ("' . implode('","', $notAllowedCoursesToCurrentUser) . '"))';
5117
        }
5118
5119
        return $visibilityCondition;
5120
    }