Code Duplication    Length = 5-5 lines in 2 locations

src/Chamilo/CourseBundle/Component/CourseCopy/CourseRestorer.php 2 locations

@@ 594-598 (lines=5) @@
591
                            }
592
                            $new_file_name = $file_name_no_ext.'_'.$i.$ext;
593
                            $file_exists = file_exists($path.$new_file_name);
594
                            while ($file_exists) {
595
                                $i++;
596
                                $new_file_name = $file_name_no_ext.'_'.$i.$ext;
597
                                $file_exists = file_exists($path.$new_file_name);
598
                            }
599
600
                            if (!empty($session_id)) {
601
                                $document_path = explode('/', $document->path, 3);
@@ 1004-1008 (lines=5) @@
1001
                            $new_file_name = $file_name_no_ext.'_'.$i.$ext;
1002
                            $file_exists = file_exists($path.$new_file_name);
1003
1004
                            while ($file_exists) {
1005
                                $i++;
1006
                                $new_file_name = $file_name_no_ext.'_'.$i.$ext;
1007
                                $file_exists = file_exists($path.$new_file_name);
1008
                            }
1009
1010
                            rename(
1011
                                $this->course->backup_path.'/'.$document->path,