Jarves\Controller\Admin\FileController::pasteAction PHP Method

pasteAction() public method

public pasteAction ( FOS\RestBundle\Request\ParamFetcher $paramFetcher ) : array | boolean
$paramFetcher FOS\RestBundle\Request\ParamFetcher
return array | boolean returns [targetExists => true] when a target exists and $overwrite=false, otherwise true/false.
    public function pasteAction(ParamFetcher $paramFetcher)
    {
        $files = $paramFetcher->get('files');
        $target = $paramFetcher->get('target');
        $overwrite = filter_var($paramFetcher->get('overwrite'), FILTER_VALIDATE_BOOLEAN);
        $move = filter_var($paramFetcher->get('move'), FILTER_VALIDATE_BOOLEAN);
        $this->checkAccess($target);
        foreach ($files as $file) {
            $this->checkAccess($file);
            $newPath = $target . '/' . basename($file);
            if (!$overwrite && $this->webFilesystem->has($newPath)) {
                return ['targetExists' => true];
            }
            $this->newFeed($file, $move ? 'moved' : 'copied', sprintf('from %s to %s', $file, $newPath));
        }
        return $this->webFilesystem->paste($files, $target, $move ? 'move' : 'copy');
    }