Code Duplication    Length = 6-7 lines in 3 locations

src/Share.php 3 locations

@@ 216-222 (lines=7) @@
213
	 * @throws \Icewind\SMB\Exception\NotFoundException
214
	 * @throws \Icewind\SMB\Exception\AlreadyExistsException
215
	 */
216
	public function rename($from, $to) {
217
		$path1 = $this->escapePath($from);
218
		$path2 = $this->escapePath($to);
219
		$cmd = 'rename ' . $path1 . ' ' . $path2;
220
		$output = $this->execute($cmd);
221
		return $this->parseOutput($output, $to);
222
	}
223
224
	/**
225
	 * Upload a local file
@@ 234-239 (lines=6) @@
231
	 * @throws \Icewind\SMB\Exception\NotFoundException
232
	 * @throws \Icewind\SMB\Exception\InvalidTypeException
233
	 */
234
	public function put($source, $target) {
235
		$path1 = $this->escapeLocalPath($source); //first path is local, needs different escaping
236
		$path2 = $this->escapePath($target);
237
		$output = $this->execute('put ' . $path1 . ' ' . $path2);
238
		return $this->parseOutput($output, $target);
239
	}
240
241
	/**
242
	 * Download a remote file
@@ 251-256 (lines=6) @@
248
	 * @throws \Icewind\SMB\Exception\NotFoundException
249
	 * @throws \Icewind\SMB\Exception\InvalidTypeException
250
	 */
251
	public function get($source, $target) {
252
		$path1 = $this->escapePath($source);
253
		$path2 = $this->escapeLocalPath($target); //second path is local, needs different escaping
254
		$output = $this->execute('get ' . $path1 . ' ' . $path2);
255
		return $this->parseOutput($output, $source);
256
	}
257
258
	/**
259
	 * Open a readable stream to a remote file