Code Duplication    Length = 4-5 lines in 5 locations

php/elFinder.class.php 5 locations

@@ 1142-1145 (lines=4) @@
1139
		$target = $args['target'];
1140
		$name   = $args['name'];
1141
		
1142
		if (($volume = $this->volume($target)) == false
1143
		||  ($rm  = $volume->file($target)) == false) {
1144
			return array('error' => $this->error(self::ERROR_RENAME, '#'.$target, self::ERROR_FILE_NOT_FOUND));
1145
		}
1146
		$rm['realpath'] = $volume->realpath($target);
1147
		
1148
		return ($file = $volume->rename($target, $name)) == false
@@ 1166-1170 (lines=5) @@
1163
		$suffix  = empty($args['suffix']) ? 'copy' : $args['suffix'];
1164
		
1165
		foreach ($targets as $target) {
1166
			if (($volume = $this->volume($target)) == false
1167
			|| ($src = $volume->file($target)) == false) {
1168
				$result['warning'] = $this->error(self::ERROR_COPY, '#'.$target, self::ERROR_FILE_NOT_FOUND);
1169
				break;
1170
			}
1171
			
1172
			if (($file = $volume->duplicate($target, $suffix)) == false) {
1173
				$result['warning'] = $this->error($volume->error());
@@ 2072-2075 (lines=4) @@
2069
	protected function put($args) {
2070
		$target = $args['target'];
2071
		
2072
		if (($volume = $this->volume($target)) == false
2073
		|| ($file = $volume->file($target)) == false) {
2074
			return array('error' => $this->error(self::ERROR_SAVE, '#'.$target, self::ERROR_FILE_NOT_FOUND));
2075
		}
2076
		
2077
		if (($file = $volume->putContents($target, $args['content'])) == false) {
2078
			return array('error' => $this->error(self::ERROR_SAVE, $volume->path($target), $volume->error()));
@@ 2098-2101 (lines=4) @@
2095
		$error  = array(self::ERROR_EXTRACT, '#'.$target);
2096
		$makedir = isset($args['makedir'])? (bool)$args['makedir'] : null;
2097
2098
		if (($volume = $this->volume($target)) == false
2099
		|| ($file = $volume->file($target)) == false) {
2100
			return array('error' => $this->error(self::ERROR_EXTRACT, '#'.$target, self::ERROR_FILE_NOT_FOUND));
2101
		}  
2102
2103
		return ($file = $volume->extract($target, $makedir))
2104
			? array('added' => isset($file['read'])? array($file) : $file)
@@ 2252-2255 (lines=4) @@
2249
		$degree = (int)$args['degree'];
2250
		$quality= (int)$args['quality'];
2251
		
2252
		if (($volume = $this->volume($target)) == false
2253
		|| ($file = $volume->file($target)) == false) {
2254
			return array('error' => $this->error(self::ERROR_RESIZE, '#'.$target, self::ERROR_FILE_NOT_FOUND));
2255
		}
2256
2257
		return ($file = $volume->resize($target, $width, $height, $x, $y, $mode, $bg, $degree, $quality))
2258
			? array('changed' => array($file))