Code Duplication    Length = 6-6 lines in 3 locations

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

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