elFinder\elFinder::paste PHP Method

paste() protected method

Copy/move files into new destination
Author: Dmitry (dio) Levashov
protected paste ( $args ) : array
return array
    protected function paste($args)
    {
        $dst = $args['dst'];
        $targets = is_array($args['targets']) ? $args['targets'] : array();
        $cut = !empty($args['cut']);
        $error = $cut ? self::ERROR_MOVE : self::ERROR_COPY;
        $result = array('added' => array(), 'removed' => array());
        if (($dstVolume = $this->volume($dst)) == false) {
            return array('error' => $this->error($error, '#' . $targets[0], self::ERROR_TRGDIR_NOT_FOUND, '#' . $dst));
        }
        foreach ($targets as $target) {
            if (($srcVolume = $this->volume($target)) == false) {
                $result['warning'] = $this->error($error, '#' . $target, self::ERROR_FILE_NOT_FOUND);
                break;
            }
            if (($file = $dstVolume->paste($srcVolume, $target, $dst, $cut)) == false) {
                $result['warning'] = $this->error($dstVolume->error());
                break;
            }
            $result['added'][] = $file;
        }
        return $result;
    }