Code Duplication    Length = 8-8 lines in 2 locations

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

@@ 595-602 (lines=8) @@
592
							case FILE_RENAME:
593
								$i = 1;
594
								$ext = explode('.', basename($document->path));
595
								if (count($ext) > 1) {
596
									$ext = array_pop($ext);
597
									$file_name_no_ext = substr($document->path, 0, - (strlen($ext) + 1));
598
									$ext = '.'.$ext;
599
								} else {
600
									$ext = '';
601
									$file_name_no_ext = $document->path;
602
								}
603
								$new_file_name = $file_name_no_ext.'_'.$i.$ext;
604
								$file_exists = file_exists($path.$new_file_name);
605
								while ($file_exists) {
@@ 981-988 (lines=8) @@
978
                        case FILE_RENAME:
979
							$i = 1;
980
							$ext = explode('.', basename($document->path));
981
							if (count($ext) > 1) {
982
								$ext = array_pop($ext);
983
								$file_name_no_ext = substr($document->path, 0, - (strlen($ext) + 1));
984
								$ext = '.'.$ext;
985
							} else {
986
								$ext = '';
987
								$file_name_no_ext = $document->path;
988
							}
989
990
							$new_file_name = $file_name_no_ext.'_'.$i.$ext;
991
							$file_exists = file_exists($path.$new_file_name);