Code Duplication    Length = 6-6 lines in 3 locations

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

@@ 1021-1026 (lines=6) @@
1018
    if (isset($course_info) && isset($course_info['visibility'])) {
1019
        switch ($course_info['visibility']) {
1020
            default:
1021
            case COURSE_VISIBILITY_CLOSED:
1022
                // Completely closed: the course is only accessible to the teachers. - 0
1023
                if (api_get_user_id() && !api_is_anonymous() && $is_allowed_in_course) {
1024
                    $is_visible = true;
1025
                }
1026
                break;
1027
            case COURSE_VISIBILITY_REGISTERED:
1028
                // Private - access authorized to course members only - 1
1029
                if (api_get_user_id() && !api_is_anonymous() && $is_allowed_in_course) {
@@ 1027-1032 (lines=6) @@
1024
                    $is_visible = true;
1025
                }
1026
                break;
1027
            case COURSE_VISIBILITY_REGISTERED:
1028
                // Private - access authorized to course members only - 1
1029
                if (api_get_user_id() && !api_is_anonymous() && $is_allowed_in_course) {
1030
                    $is_visible = true;
1031
                }
1032
                break;
1033
            case COURSE_VISIBILITY_OPEN_PLATFORM:
1034
                // Open - access allowed for users registered on the platform - 2
1035
                if (api_get_user_id() && !api_is_anonymous() && $is_allowed_in_course) {
@@ 1033-1038 (lines=6) @@
1030
                    $is_visible = true;
1031
                }
1032
                break;
1033
            case COURSE_VISIBILITY_OPEN_PLATFORM:
1034
                // Open - access allowed for users registered on the platform - 2
1035
                if (api_get_user_id() && !api_is_anonymous() && $is_allowed_in_course) {
1036
                    $is_visible = true;
1037
                }
1038
                break;
1039
            case COURSE_VISIBILITY_OPEN_WORLD:
1040
                //Open - access allowed for the whole world - 3
1041
                $is_visible = true;