Code Duplication    Length = 17-17 lines in 2 locations

main/coursecopy/classes/CourseRestorer.class.php 2 locations

@@ 732-748 (lines=17) @@
729
                                            copy($path.$document->path, $path.$new_file_name);
730
									    }
731
                                        //Replace old course code with the new destination code see BT#1985
732
                                        if (file_exists($path.$new_file_name)) {
733
                                            $file_info = pathinfo($path.$new_file_name);
734
                                            if (in_array($file_info['extension'], array('html','htm'))) {
735
                                                $content    = file_get_contents($path.$new_file_name);
736
                                                if (UTF8_CONVERT) {
737
                                                    $content = utf8_encode($content);
738
                                                }
739
                                                $content = DocumentManager::replace_urls_inside_content_html_from_copy_course(
740
                                                    $content,
741
                                                    $this->course->code,
742
                                                    $this->course->destination_path,
743
                                                    $this->course->backup_path,
744
                                                    $this->course->info['path']
745
                                                );
746
                                                file_put_contents($path.$new_file_name, $content);
747
                                            }
748
                                        }
749
750
                                        $params = [
751
                                            'path' => "/".self::DBUTF8escapestring(substr($new_file_name, 9)),
@@ 795-811 (lines=17) @@
792
									copy($this->course->backup_path.'/'.$document->path, $path.$new_file_name);
793
794
                                    //Replace old course code with the new destination code see BT#1985
795
                                    if (file_exists($path.$new_file_name)) {
796
                                        $file_info = pathinfo($path.$new_file_name);
797
                                        if (in_array($file_info['extension'], array('html','htm'))) {
798
                                            $content    = file_get_contents($path.$new_file_name);
799
                                            if (UTF8_CONVERT) {
800
                                                $content = utf8_encode($content);
801
                                            }
802
                                            $content = DocumentManager::replace_urls_inside_content_html_from_copy_course(
803
                                                $content,
804
                                                $this->course->code,
805
                                                $this->course->destination_path,
806
                                                $this->course->backup_path,
807
                                                $this->course->info['path']
808
                                            );
809
                                            file_put_contents($path.$new_file_name, $content);
810
                                        }
811
                                    }
812
813
                                    $params = [
814
                                        'c_id' => $this->destination_course_id,