This repository has been archived by the owner on Feb 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #99 from marcaube/flysystem
Add support for league/flysystem adapters using oneup/flysystem-bundle
- Loading branch information
Showing
7 changed files
with
89 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
namespace Dizda\CloudBackupBundle\Client; | ||
|
||
use League\Flysystem\FilesystemInterface; | ||
|
||
/** | ||
* Client for Flysystem adapters. | ||
* | ||
* @author Marc Aubé | ||
*/ | ||
class FlysystemClient implements ClientInterface | ||
{ | ||
/** | ||
* @var FilesystemInterface[] | ||
*/ | ||
private $filesystems; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function upload($archive) | ||
{ | ||
$fileName = explode('/', $archive); | ||
|
||
/** @var FilesystemInterface $filesystem */ | ||
foreach ($this->filesystems as $filesystem) { | ||
$filesystem->write(end($fileName), file_get_contents($archive)); | ||
} | ||
} | ||
|
||
/** | ||
* Add a filesystem adapter. | ||
* | ||
* @param FilesystemInterface $filesystem | ||
*/ | ||
public function addFilesystem(FilesystemInterface $filesystem) | ||
{ | ||
$this->filesystems[] = $filesystem; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getName() | ||
{ | ||
return 'Flysystem'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters