create filesystem abstraction

This commit is contained in:
Yisroel Baum 2026-06-26 08:26:11 +03:00
parent be2c51bfb7
commit d59d444952
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
14 changed files with 44 additions and 64 deletions

View file

@ -3,7 +3,7 @@
namespace App\Element\UseCases\GetElementPdf;
use App\Exceptions\NotFoundException;
use App\Shared\Files\StoredFileReader;
use App\Shared\Files\Filesystem;
class GetElementPdf
{
@ -11,7 +11,7 @@ class GetElementPdf
private const PDF_MIME_TYPE = 'application/pdf';
public function __construct(private StoredFileReader $storedFileReader)
public function __construct(private Filesystem $filesystem)
{
}
@ -29,7 +29,7 @@ class GetElementPdf
}
$path = "element-pdfs/$request->folder/$request->fileName";
$contents = $this->storedFileReader->read($path);
$contents = $this->filesystem->read($path);
if ($contents === null) {
throw new NotFoundException('PDF not found');
}