Code Duplication    Length = 6-6 lines in 3 locations

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

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