Code Duplication    Length = 4-5 lines in 5 locations

php/elFinder.class.php 5 locations

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