Code Duplication    Length = 4-5 lines in 5 locations

php/elFinder.class.php 5 locations

@@ 1147-1150 (lines=4) @@
1144
		$target = $args['target'];
1145
		$name   = $args['name'];
1146
		
1147
		if (($volume = $this->volume($target)) == false
1148
		||  ($rm  = $volume->file($target)) == false) {
1149
			return array('error' => $this->error(self::ERROR_RENAME, '#'.$target, self::ERROR_FILE_NOT_FOUND));
1150
		}
1151
		$rm['realpath'] = $volume->realpath($target);
1152
		
1153
		return ($file = $volume->rename($target, $name)) == false
@@ 1171-1175 (lines=5) @@
1168
		$suffix  = empty($args['suffix']) ? 'copy' : $args['suffix'];
1169
		
1170
		foreach ($targets as $target) {
1171
			if (($volume = $this->volume($target)) == false
1172
			|| ($src = $volume->file($target)) == false) {
1173
				$result['warning'] = $this->error(self::ERROR_COPY, '#'.$target, self::ERROR_FILE_NOT_FOUND);
1174
				break;
1175
			}
1176
			
1177
			if (($file = $volume->duplicate($target, $suffix)) == false) {
1178
				$result['warning'] = $this->error($volume->error());
@@ 2077-2080 (lines=4) @@
2074
	protected function put($args) {
2075
		$target = $args['target'];
2076
		
2077
		if (($volume = $this->volume($target)) == false
2078
		|| ($file = $volume->file($target)) == false) {
2079
			return array('error' => $this->error(self::ERROR_SAVE, '#'.$target, self::ERROR_FILE_NOT_FOUND));
2080
		}
2081
		
2082
		if (($file = $volume->putContents($target, $args['content'])) == false) {
2083
			return array('error' => $this->error(self::ERROR_SAVE, $volume->path($target), $volume->error()));
@@ 2103-2106 (lines=4) @@
2100
		$error  = array(self::ERROR_EXTRACT, '#'.$target);
2101
		$makedir = isset($args['makedir'])? (bool)$args['makedir'] : null;
2102
2103
		if (($volume = $this->volume($target)) == false
2104
		|| ($file = $volume->file($target)) == false) {
2105
			return array('error' => $this->error(self::ERROR_EXTRACT, '#'.$target, self::ERROR_FILE_NOT_FOUND));
2106
		}  
2107
2108
		return ($file = $volume->extract($target, $makedir))
2109
			? array('added' => isset($file['read'])? array($file) : $file)
@@ 2257-2260 (lines=4) @@
2254
		$degree = (int)$args['degree'];
2255
		$quality= (int)$args['quality'];
2256
		
2257
		if (($volume = $this->volume($target)) == false
2258
		|| ($file = $volume->file($target)) == false) {
2259
			return array('error' => $this->error(self::ERROR_RESIZE, '#'.$target, self::ERROR_FILE_NOT_FOUND));
2260
		}
2261
2262
		return ($file = $volume->resize($target, $width, $height, $x, $y, $mode, $bg, $degree, $quality))
2263
			? array('changed' => array($file))