Code Duplication    Length = 4-5 lines in 5 locations

php/elFinder.class.php 5 locations

@@ 1149-1152 (lines=4) @@
1146
		$target = $args['target'];
1147
		$name   = $args['name'];
1148
		
1149
		if (($volume = $this->volume($target)) == false
1150
		||  ($rm  = $volume->file($target)) == false) {
1151
			return array('error' => $this->error(self::ERROR_RENAME, '#'.$target, self::ERROR_FILE_NOT_FOUND));
1152
		}
1153
		$rm['realpath'] = $volume->realpath($target);
1154
		
1155
		return ($file = $volume->rename($target, $name)) == false
@@ 1173-1177 (lines=5) @@
1170
		$suffix  = empty($args['suffix']) ? 'copy' : $args['suffix'];
1171
		
1172
		foreach ($targets as $target) {
1173
			if (($volume = $this->volume($target)) == false
1174
			|| ($src = $volume->file($target)) == false) {
1175
				$result['warning'] = $this->error(self::ERROR_COPY, '#'.$target, self::ERROR_FILE_NOT_FOUND);
1176
				break;
1177
			}
1178
			
1179
			if (($file = $volume->duplicate($target, $suffix)) == false) {
1180
				$result['warning'] = $this->error($volume->error());
@@ 2079-2082 (lines=4) @@
2076
	protected function put($args) {
2077
		$target = $args['target'];
2078
		
2079
		if (($volume = $this->volume($target)) == false
2080
		|| ($file = $volume->file($target)) == false) {
2081
			return array('error' => $this->error(self::ERROR_SAVE, '#'.$target, self::ERROR_FILE_NOT_FOUND));
2082
		}
2083
		
2084
		if (($file = $volume->putContents($target, $args['content'])) == false) {
2085
			return array('error' => $this->error(self::ERROR_SAVE, $volume->path($target), $volume->error()));
@@ 2105-2108 (lines=4) @@
2102
		$error  = array(self::ERROR_EXTRACT, '#'.$target);
2103
		$makedir = isset($args['makedir'])? (bool)$args['makedir'] : null;
2104
2105
		if (($volume = $this->volume($target)) == false
2106
		|| ($file = $volume->file($target)) == false) {
2107
			return array('error' => $this->error(self::ERROR_EXTRACT, '#'.$target, self::ERROR_FILE_NOT_FOUND));
2108
		}  
2109
2110
		return ($file = $volume->extract($target, $makedir))
2111
			? array('added' => isset($file['read'])? array($file) : $file)
@@ 2267-2270 (lines=4) @@
2264
		$degree = (int)$args['degree'];
2265
		$quality= (int)$args['quality'];
2266
		
2267
		if (($volume = $this->volume($target)) == false
2268
		|| ($file = $volume->file($target)) == false) {
2269
			return array('error' => $this->error(self::ERROR_RESIZE, '#'.$target, self::ERROR_FILE_NOT_FOUND));
2270
		}
2271
2272
		return ($file = $volume->resize($target, $width, $height, $x, $y, $mode, $bg, $degree, $quality))
2273
			? array('changed' => array($file))