Code Duplication    Length = 9-10 lines in 2 locations

apps/files_trashbin/ajax/undelete.php 1 location

@@ 61-70 (lines=10) @@
58
$i = 0;
59
foreach ($list as $file) {
60
	$path = $dir . '/' . $file;
61
	if ($dir === '/') {
62
		$file = ltrim($file, '/');
63
		$delimiter = strrpos($file, '.d');
64
		$filename = substr($file, 0, $delimiter);
65
		$timestamp =  substr($file, $delimiter+2);
66
	} else {
67
		$path_parts = pathinfo($file);
68
		$filename = $path_parts['basename'];
69
		$timestamp = null;
70
	}
71
72
	if ( !OCA\Files_Trashbin\Trashbin::restore($path, $filename, $timestamp) ) {
73
		$error[] = $filename;

apps/files_trashbin/ajax/delete.php 1 location

@@ 56-64 (lines=9) @@
53
54
$i = 0;
55
foreach ($list as $file) {
56
	if ($folder === '/') {
57
		$file = ltrim($file, '/');
58
		$delimiter = strrpos($file, '.d');
59
		$filename = substr($file, 0, $delimiter);
60
		$timestamp =  substr($file, $delimiter+2);
61
	} else {
62
		$filename = $folder . '/' . $file;
63
		$timestamp = null;
64
	}
65
66
	OCA\Files_Trashbin\Trashbin::delete($filename, \OCP\User::getUser(), $timestamp);
67
	if (OCA\Files_Trashbin\Trashbin::file_exists($filename, $timestamp)) {