Code Duplication    Length = 6-6 lines in 3 locations

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

@@ 1096-1101 (lines=6) @@
1093
    if (isset($course_info) && isset($course_info['visibility'])) {
1094
        switch ($course_info['visibility']) {
1095
            default:
1096
            case COURSE_VISIBILITY_CLOSED:
1097
                // Completely closed: the course is only accessible to the teachers. - 0
1098
                if (api_get_user_id() && !api_is_anonymous() && $is_allowed_in_course) {
1099
                    $is_visible = true;
1100
                }
1101
                break;
1102
            case COURSE_VISIBILITY_REGISTERED:
1103
                // Private - access authorized to course members only - 1
1104
                if (api_get_user_id() && !api_is_anonymous() && $is_allowed_in_course) {
@@ 1102-1107 (lines=6) @@
1099
                    $is_visible = true;
1100
                }
1101
                break;
1102
            case COURSE_VISIBILITY_REGISTERED:
1103
                // Private - access authorized to course members only - 1
1104
                if (api_get_user_id() && !api_is_anonymous() && $is_allowed_in_course) {
1105
                    $is_visible = true;
1106
                }
1107
                break;
1108
            case COURSE_VISIBILITY_OPEN_PLATFORM:
1109
                // Open - access allowed for users registered on the platform - 2
1110
                if (api_get_user_id() && !api_is_anonymous() && $is_allowed_in_course) {
@@ 1108-1113 (lines=6) @@
1105
                    $is_visible = true;
1106
                }
1107
                break;
1108
            case COURSE_VISIBILITY_OPEN_PLATFORM:
1109
                // Open - access allowed for users registered on the platform - 2
1110
                if (api_get_user_id() && !api_is_anonymous() && $is_allowed_in_course) {
1111
                    $is_visible = true;
1112
                }
1113
                break;
1114
            case COURSE_VISIBILITY_OPEN_WORLD:
1115
                //Open - access allowed for the whole world - 3
1116
                $is_visible = true;