Code Duplication    Length = 12-15 lines in 2 locations

main/cron/import_csv.php 1 location

@@ 875-889 (lines=15) @@
872
                            "Course '$courseCode' is not included in session: $sessionId"
873
                        );
874
                        $errorFound = true;
875
                    } else {
876
                        $teachers = CourseManager::get_coach_list_from_course_code(
877
                            $courseInfo['code'],
878
                            $sessionId
879
                        );
880
881
                        // Getting first teacher.
882
                        if (!empty($teachers)) {
883
                            $teacher = current($teachers);
884
                            $teacherId = $teacher['user_id'];
885
                        } else {
886
                            $sessionInfo = api_get_session_info($sessionId);
887
                            $teacherId = $sessionInfo['id_coach'];
888
                        }
889
                    }
890
                } else {
891
                    $errorFound = true;
892
                }

main/inc/lib/AnnouncementManager.php 1 location

@@ 70-81 (lines=12) @@
67
        $generalCoachName = '';
68
        $generalCoachEmail = '';
69
        $coaches = '';
70
        if (!empty($sessionId)) {
71
            $sessionInfo = api_get_session_info($sessionId);
72
73
            $coaches = CourseManager::get_coachs_from_course_to_string(
74
                $sessionId,
75
                $courseInfo['real_id']
76
            );
77
78
            $generalCoach = api_get_user_info($sessionInfo['id_coach']);
79
            $generalCoachName = $generalCoach['complete_name'];
80
            $generalCoachEmail = $generalCoach['email'];
81
        }
82
83
        $data = [];
84
        $data['user_name'] = '';