protected function duplicate($args) {
		$targets = is_array($args['targets']) ? $args['targets'] : array();
		$result  = array('added' => array());
		$suffix  = empty($args['suffix']) ? 'copy' : $args['suffix'];
		
		foreach ($targets as $target) {
			if (($volume = $this->volume($target)) == false
			|| ($src = $volume->file($target)) == false) {
				$result['warning'] = $this->error(self::ERROR_COPY, '#'.$target, self::ERROR_FILE_NOT_FOUND);
				break;
			}
			
			if (($file = $volume->duplicate($target, $suffix)) == false) {
				$result['warning'] = $this->error($volume->error());
				break;
			}
			
			$result['added'][] = $file;
		}
		
		return $result;
	}
protected function duplicate($args) {
		$targets = is_array($args['targets']) ? $args['targets'] : array();
		$result  = array('added' => array());
		$suffix  = empty($args['suffix']) ? 'copy' : $args['suffix'];
		
		foreach ($targets as $target) {
			if (($volume = $this->volume($target)) == false
			|| ($src = $volume->file($target)) == false) {
				$result['warning'] = $this->error(self::ERROR_COPY, '#'.$target, self::ERROR_FILE_NOT_FOUND);
				break;
			}
			
			if (($file = $volume->duplicate($target, $suffix)) == false) {
				$result['warning'] = $this->error($volume->error());
				break;
			}
			
			$result['added'][] = $file;
		}
		
		return $result;
	}
protected function duplicate ( $ args ) { $ targets = is_array ( $ args [ 'targets' ] ) ? $ args [ 'targets' ] : array ( ) ; $ result = array ( 'added' => array ( ) ) ; $ suffix = empty ( $ args [ 'suffix' ] ) ? 'copy' : $ args [ 'suffix' ] ; foreach ( $ targets as $ target ) { if ( ( $ volume = $ this -> volume ( $ target ) ) == false || ( $ src = $ volume -> file ( $ target ) ) == false ) { $ result [ 'warning' ] = $ this -> error ( self :: ERROR_COPY , '#' . $ target , self :: ERROR_FILE_NOT_FOUND ) ; break ; } if ( ( $ file = $ volume -> duplicate ( $ target , $ suffix ) ) == false ) { $ result [ 'warning' ] = $ this -> error ( $ volume -> error ( ) ) ; break ; } $ result [ 'added' ] [ ] = $ file ; } return $ result ; }
Duplicate file - create copy with "copy %d" suffix

@param array  $args  command arguments
@return array
@author Dmitry (dio) Levashov
Duplicate file - create copy with copy %d suffix