Code Duplication    Length = 6-6 lines in 3 locations

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

@@ 1060-1065 (lines=6) @@
1057
    if (isset($course_info) && isset($course_info['visibility'])) {
1058
        switch ($course_info['visibility']) {
1059
            default:
1060
            case COURSE_VISIBILITY_CLOSED:
1061
                // Completely closed: the course is only accessible to the teachers. - 0
1062
                if (api_get_user_id() && !api_is_anonymous() && $is_allowed_in_course) {
1063
                    $is_visible = true;
1064
                }
1065
                break;
1066
            case COURSE_VISIBILITY_REGISTERED:
1067
                // Private - access authorized to course members only - 1
1068
                if (api_get_user_id() && !api_is_anonymous() && $is_allowed_in_course) {
@@ 1066-1071 (lines=6) @@
1063
                    $is_visible = true;
1064
                }
1065
                break;
1066
            case COURSE_VISIBILITY_REGISTERED:
1067
                // Private - access authorized to course members only - 1
1068
                if (api_get_user_id() && !api_is_anonymous() && $is_allowed_in_course) {
1069
                    $is_visible = true;
1070
                }
1071
                break;
1072
            case COURSE_VISIBILITY_OPEN_PLATFORM:
1073
                // Open - access allowed for users registered on the platform - 2
1074
                if (api_get_user_id() && !api_is_anonymous() && $is_allowed_in_course) {
@@ 1072-1077 (lines=6) @@
1069
                    $is_visible = true;
1070
                }
1071
                break;
1072
            case COURSE_VISIBILITY_OPEN_PLATFORM:
1073
                // Open - access allowed for users registered on the platform - 2
1074
                if (api_get_user_id() && !api_is_anonymous() && $is_allowed_in_course) {
1075
                    $is_visible = true;
1076
                }
1077
                break;
1078
            case COURSE_VISIBILITY_OPEN_WORLD:
1079
                //Open - access allowed for the whole world - 3
1080
                $is_visible = true;