Code Duplication    Length = 6-6 lines in 3 locations

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

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