<?php declare(strict_types=1);
namespace Swag\BasicExample\Service;
use League\Flysystem\FilesystemInterface;
class ExampleFilesystemService
* @var FilesystemInterface
private FilesystemInterface $fileSystemPublic;
* @var FilesystemInterface
private FilesystemInterface $fileSystemPrivate;
* ExampleFilesystemService constructor.
* @param FilesystemInterface $fileSystemPublic
* @param FilesystemInterface $fileSystemPrivate
public function __construct(FilesystemInterface $fileSystemPublic, FilesystemInterface $fileSystemPrivate)
$this->fileSystemPublic = $fileSystemPublic;
$this->fileSystemPrivate = $fileSystemPrivate;
public function readPrivateFile(string $filename) {
return $this->fileSystemPrivate->read($filename);
public function writePrivateFile(string $filename, string $content) {
$this->fileSystemPrivate->write($filename, $content);
public function listPublicFiles(): array {
return $this->fileSystemPublic->listContents();