Task/File/FileFetchTask.php
protected function doFileCopy(ProcessState $state, $filename, $removeSource)
    {
        $prefixFrom = $this->getOption($state, 'source_filesystem');
        $prefixTo = $this->getOption($state, 'destination_filesystem');

        $buffer = $this->mountManager->getFilesystem($prefixFrom)->readStream($filename);

        if (false === $buffer) {
            return false;
        }

        $result = $this->mountManager->getFilesystem($prefixTo)->putStream($filename, $buffer);

        if (\is_resource($buffer)) {
            fclose($buffer);
        }

        if ($removeSource) {
            $this->mountManager->delete(sprintf('%s://%s', $prefixFrom, $filename));
        }

        return $result ? $filename : null;
    }
protected function doFileCopy(ProcessState $state, $filename, $removeSource)
    {
        $prefixFrom = $this->getOption($state, 'source_filesystem');
        $prefixTo = $this->getOption($state, 'destination_filesystem');

        $buffer = $this->mountManager->getFilesystem($prefixFrom)->readStream($filename);

        if (false === $buffer) {
            return false;
        }

        $result = $this->mountManager->getFilesystem($prefixTo)->putStream($filename, $buffer);

        if (\is_resource($buffer)) {
            fclose($buffer);
        }

        if ($removeSource) {
            $this->mountManager->delete(sprintf('%s://%s', $prefixFrom, $filename));
        }

        return $result ? $filename : null;
    }
@param ProcessState $state
@param string       $filename
@param bool         $removeSource

@throws \League\Flysystem\FileNotFoundException
@throws \Symfony\Component\OptionsResolver\Exception\ExceptionInterface
@throws \League\Flysystem\FilesystemNotFoundException
@throws \InvalidArgumentException

@return mixed