Code Duplication    Length = 6-6 lines in 3 locations

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

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