Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure you want to rename?
SAFE MODE
/
modules
/
backup
/
vendor
/
backup-manager
/
backup-manager
/
src
/
Tasks
/
Storage
:
TransferFile.php
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php namespace BackupManager\Tasks\Storage; use League\Flysystem\Filesystem; use BackupManager\Tasks\Task; /** * Class TransferFile * @package BackupManager\Tasks\Storage */ class TransferFile implements Task { /** @var Filesystem */ private $sourceFilesystem; /** @var string */ private $sourcePath; /** @var Filesystem */ private $destinationFilesystem; /** @var string */ private $destinationPath; /** * @param Filesystem $sourceFilesystem * @param $sourcePath * @param Filesystem $destinationFilesystem * @param $destinationPath */ public function __construct(Filesystem $sourceFilesystem, $sourcePath, Filesystem $destinationFilesystem, $destinationPath) { $this->sourceFilesystem = $sourceFilesystem; $this->sourcePath = $sourcePath; $this->destinationFilesystem = $destinationFilesystem; $this->destinationPath = $destinationPath; } /** * @throws \InvalidArgumentException */ public function execute() { $this->destinationFilesystem->writeStream( $this->destinationPath, $this->sourceFilesystem->readStream($this->sourcePath) ); } }