Code Duplication    Length = 17-17 lines in 2 locations

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

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