Code Duplication    Length = 6-6 lines in 3 locations

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

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