Code Duplication    Length = 6-7 lines in 3 locations

src/Share.php 3 locations

@@ 211-217 (lines=7) @@
208
	 * @throws \Icewind\SMB\Exception\NotFoundException
209
	 * @throws \Icewind\SMB\Exception\AlreadyExistsException
210
	 */
211
	public function rename($from, $to) {
212
		$path1 = $this->escapePath($from);
213
		$path2 = $this->escapePath($to);
214
		$cmd = 'rename ' . $path1 . ' ' . $path2;
215
		$output = $this->execute($cmd);
216
		return $this->parseOutput($output, $to);
217
	}
218
219
	/**
220
	 * Upload a local file
@@ 229-234 (lines=6) @@
226
	 * @throws \Icewind\SMB\Exception\NotFoundException
227
	 * @throws \Icewind\SMB\Exception\InvalidTypeException
228
	 */
229
	public function put($source, $target) {
230
		$path1 = $this->escapeLocalPath($source); //first path is local, needs different escaping
231
		$path2 = $this->escapePath($target);
232
		$output = $this->execute('put ' . $path1 . ' ' . $path2);
233
		return $this->parseOutput($output, $target);
234
	}
235
236
	/**
237
	 * Download a remote file
@@ 246-251 (lines=6) @@
243
	 * @throws \Icewind\SMB\Exception\NotFoundException
244
	 * @throws \Icewind\SMB\Exception\InvalidTypeException
245
	 */
246
	public function get($source, $target) {
247
		$path1 = $this->escapePath($source);
248
		$path2 = $this->escapeLocalPath($target); //second path is local, needs different escaping
249
		$output = $this->execute('get ' . $path1 . ' ' . $path2);
250
		return $this->parseOutput($output, $source);
251
	}
252
253
	/**
254
	 * Open a readable stream to a remote file