Code Duplication    Length = 8-8 lines in 2 locations

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

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