Code Duplication    Length = 4-4 lines in 2 locations

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

@@ 5009-5012 (lines=4) @@
5006
        $currentUserId = api_get_user_id();
5007
        $restrictedCourses = self::getCatalogueCourseList(true);
5008
        $allowedCoursesToCurrentUser = self::getCatalogueCourseList(true, $currentUserId);
5009
        if (!empty($restrictedCourses)) {
5010
            $visibilityCondition .= ' AND ('.$courseTableAlias.'.code NOT IN ("' . implode('","', $restrictedCourses) . '")';
5011
            $visibilityCondition .= ' OR '.$courseTableAlias.'.code IN ("' . implode('","', $allowedCoursesToCurrentUser) . '"))';
5012
        }
5013
5014
        // Check if course have users denied to see it in the catalogue, then show only if current user is not denied to see it
5015
        $restrictedCourses = self::getCatalogueCourseList(false);
@@ 5017-5020 (lines=4) @@
5014
        // Check if course have users denied to see it in the catalogue, then show only if current user is not denied to see it
5015
        $restrictedCourses = self::getCatalogueCourseList(false);
5016
        $notAllowedCoursesToCurrentUser = self::getCatalogueCourseList(false, $currentUserId);
5017
        if (!empty($restrictedCourses)) {
5018
            $visibilityCondition .= ' AND ('.$courseTableAlias.'.code NOT IN ("' . implode('","', $restrictedCourses) . '")';
5019
            $visibilityCondition .= ' OR '.$courseTableAlias.'.code NOT IN ("' . implode('","', $notAllowedCoursesToCurrentUser) . '"))';
5020
        }
5021
5022
        return $visibilityCondition;
5023
    }