Code Duplication    Length = 6-6 lines in 3 locations

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

@@ 1043-1048 (lines=6) @@
1040
    if (isset($course_info) && isset($course_info['visibility'])) {
1041
        switch ($course_info['visibility']) {
1042
            default:
1043
            case COURSE_VISIBILITY_CLOSED:
1044
                // Completely closed: the course is only accessible to the teachers. - 0
1045
                if (api_get_user_id() && !api_is_anonymous() && $is_allowed_in_course) {
1046
                    $is_visible = true;
1047
                }
1048
                break;
1049
            case COURSE_VISIBILITY_REGISTERED:
1050
                // Private - access authorized to course members only - 1
1051
                if (api_get_user_id() && !api_is_anonymous() && $is_allowed_in_course) {
@@ 1049-1054 (lines=6) @@
1046
                    $is_visible = true;
1047
                }
1048
                break;
1049
            case COURSE_VISIBILITY_REGISTERED:
1050
                // Private - access authorized to course members only - 1
1051
                if (api_get_user_id() && !api_is_anonymous() && $is_allowed_in_course) {
1052
                    $is_visible = true;
1053
                }
1054
                break;
1055
            case COURSE_VISIBILITY_OPEN_PLATFORM:
1056
                // Open - access allowed for users registered on the platform - 2
1057
                if (api_get_user_id() && !api_is_anonymous() && $is_allowed_in_course) {
@@ 1055-1060 (lines=6) @@
1052
                    $is_visible = true;
1053
                }
1054
                break;
1055
            case COURSE_VISIBILITY_OPEN_PLATFORM:
1056
                // Open - access allowed for users registered on the platform - 2
1057
                if (api_get_user_id() && !api_is_anonymous() && $is_allowed_in_course) {
1058
                    $is_visible = true;
1059
                }
1060
                break;
1061
            case COURSE_VISIBILITY_OPEN_WORLD:
1062
                //Open - access allowed for the whole world - 3
1063
                $is_visible = true;