• File: TransferFile.php
  • Full Path: /var/www/crm_set/modules/backup/vendor/backup-manager/backup-manager/src/Tasks/Storage/TransferFile.php
  • Date Modified: 09/21/2026 4:20 AM
  • File size: 1.18 KB
  • MIME-type: text/x-php
  • Charset: utf-8
<?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)
        );
    }
}