Code Duplication    Length = 6-6 lines in 3 locations

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

@@ 1185-1190 (lines=6) @@
1182
    if (isset($course_info) && isset($course_info['visibility'])) {
1183
        switch ($course_info['visibility']) {
1184
            default:
1185
            case COURSE_VISIBILITY_CLOSED:
1186
                // Completely closed: the course is only accessible to the teachers. - 0
1187
                if (api_get_user_id() && !api_is_anonymous() && $is_allowed_in_course) {
1188
                    $is_visible = true;
1189
                }
1190
                break;
1191
            case COURSE_VISIBILITY_REGISTERED:
1192
                // Private - access authorized to course members only - 1
1193
                if (api_get_user_id() && !api_is_anonymous() && $is_allowed_in_course) {
@@ 1191-1196 (lines=6) @@
1188
                    $is_visible = true;
1189
                }
1190
                break;
1191
            case COURSE_VISIBILITY_REGISTERED:
1192
                // Private - access authorized to course members only - 1
1193
                if (api_get_user_id() && !api_is_anonymous() && $is_allowed_in_course) {
1194
                    $is_visible = true;
1195
                }
1196
                break;
1197
            case COURSE_VISIBILITY_OPEN_PLATFORM:
1198
                // Open - access allowed for users registered on the platform - 2
1199
                if (api_get_user_id() && !api_is_anonymous() && $is_allowed_in_course) {
@@ 1197-1202 (lines=6) @@
1194
                    $is_visible = true;
1195
                }
1196
                break;
1197
            case COURSE_VISIBILITY_OPEN_PLATFORM:
1198
                // Open - access allowed for users registered on the platform - 2
1199
                if (api_get_user_id() && !api_is_anonymous() && $is_allowed_in_course) {
1200
                    $is_visible = true;
1201
                }
1202
                break;
1203
            case COURSE_VISIBILITY_OPEN_WORLD:
1204
                //Open - access allowed for the whole world - 3
1205
                $is_visible = true;