Code Duplication    Length = 6-6 lines in 3 locations

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

@@ 1084-1089 (lines=6) @@
1081
    if (isset($course_info) && isset($course_info['visibility'])) {
1082
        switch ($course_info['visibility']) {
1083
            default:
1084
            case COURSE_VISIBILITY_CLOSED:
1085
                // Completely closed: the course is only accessible to the teachers. - 0
1086
                if (api_get_user_id() && !api_is_anonymous() && $is_allowed_in_course) {
1087
                    $is_visible = true;
1088
                }
1089
                break;
1090
            case COURSE_VISIBILITY_REGISTERED:
1091
                // Private - access authorized to course members only - 1
1092
                if (api_get_user_id() && !api_is_anonymous() && $is_allowed_in_course) {
@@ 1090-1095 (lines=6) @@
1087
                    $is_visible = true;
1088
                }
1089
                break;
1090
            case COURSE_VISIBILITY_REGISTERED:
1091
                // Private - access authorized to course members only - 1
1092
                if (api_get_user_id() && !api_is_anonymous() && $is_allowed_in_course) {
1093
                    $is_visible = true;
1094
                }
1095
                break;
1096
            case COURSE_VISIBILITY_OPEN_PLATFORM:
1097
                // Open - access allowed for users registered on the platform - 2
1098
                if (api_get_user_id() && !api_is_anonymous() && $is_allowed_in_course) {
@@ 1096-1101 (lines=6) @@
1093
                    $is_visible = true;
1094
                }
1095
                break;
1096
            case COURSE_VISIBILITY_OPEN_PLATFORM:
1097
                // Open - access allowed for users registered on the platform - 2
1098
                if (api_get_user_id() && !api_is_anonymous() && $is_allowed_in_course) {
1099
                    $is_visible = true;
1100
                }
1101
                break;
1102
            case COURSE_VISIBILITY_OPEN_WORLD:
1103
                //Open - access allowed for the whole world - 3
1104
                $is_visible = true;