Code Duplication    Length = 12-13 lines in 2 locations

lib/private/Files/Node/Folder.php 1 location

@@ 303-314 (lines=12) @@
300
		return $this->view->free_space($this->path);
301
	}
302
303
	public function delete() {
304
		if ($this->checkPermissions(\OCP\Constants::PERMISSION_DELETE)) {
305
			$this->sendHooks(['preDelete']);
306
			$fileInfo = $this->getFileInfo();
307
			$this->view->rmdir($this->path);
308
			$nonExisting = new NonExistingFolder($this->root, $this->view, $this->path, $fileInfo);
309
			$this->root->emit('\OC\Files', 'postDelete', [$nonExisting]);
310
			$this->exists = false;
311
		} else {
312
			throw new NotPermittedException('No delete permission for path ' . $this->getFullPath($this->path));
313
		}
314
	}
315
316
	/**
317
	 * Add a suffix to the name in case the file exists

lib/private/Files/Node/File.php 1 location

@@ 114-126 (lines=13) @@
111
		}
112
	}
113
114
	public function delete() {
115
		if ($this->checkPermissions(\OCP\Constants::PERMISSION_DELETE)) {
116
			$this->sendHooks(['preDelete']);
117
			$fileInfo = $this->getFileInfo();
118
			$this->view->unlink($this->path);
119
			$nonExisting = new NonExistingFile($this->root, $this->view, $this->path, $fileInfo);
120
			$this->root->emit('\OC\Files', 'postDelete', [$nonExisting]);
121
			$this->exists = false;
122
			$this->fileInfo = null;
123
		} else {
124
			throw new NotPermittedException();
125
		}
126
	}
127
128
	/**
129
	 * @param string $type