create filesystem abstraction
This commit is contained in:
parent
be2c51bfb7
commit
d59d444952
14 changed files with 44 additions and 64 deletions
|
|
@ -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');
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue