Code Duplication    Length = 6-6 lines in 3 locations

main/inc/lib/api.lib.php 3 locations

@@ 1066-1071 (lines=6) @@
1063
    if (isset($course_info) && isset($course_info['visibility'])) {
1064
        switch ($course_info['visibility']) {
1065
            default:
1066
            case COURSE_VISIBILITY_CLOSED:
1067
                // Completely closed: the course is only accessible to the teachers. - 0
1068
                if (api_get_user_id() && !api_is_anonymous() && $is_allowed_in_course) {
1069
                    $is_visible = true;
1070
                }
1071
                break;
1072
            case COURSE_VISIBILITY_REGISTERED:
1073
                // Private - access authorized to course members only - 1
1074
                if (api_get_user_id() && !api_is_anonymous() && $is_allowed_in_course) {
@@ 1072-1077 (lines=6) @@
1069
                    $is_visible = true;
1070
                }
1071
                break;
1072
            case COURSE_VISIBILITY_REGISTERED:
1073
                // Private - access authorized to course members only - 1
1074
                if (api_get_user_id() && !api_is_anonymous() && $is_allowed_in_course) {
1075
                    $is_visible = true;
1076
                }
1077
                break;
1078
            case COURSE_VISIBILITY_OPEN_PLATFORM:
1079
                // Open - access allowed for users registered on the platform - 2
1080
                if (api_get_user_id() && !api_is_anonymous() && $is_allowed_in_course) {
@@ 1078-1083 (lines=6) @@
1075
                    $is_visible = true;
1076
                }
1077
                break;
1078
            case COURSE_VISIBILITY_OPEN_PLATFORM:
1079
                // Open - access allowed for users registered on the platform - 2
1080
                if (api_get_user_id() && !api_is_anonymous() && $is_allowed_in_course) {
1081
                    $is_visible = true;
1082
                }
1083
                break;
1084
            case COURSE_VISIBILITY_OPEN_WORLD:
1085
                //Open - access allowed for the whole world - 3
1086
                $is_visible = true;