radfusion/app/Services/Export/Formats/PdfExport.php
2025-01-10 12:43:34 +06:00

31 lines
766 B
PHP

<?php
namespace app\Services\Export\Formats;
use App\Domain\Report\ExportFormat;
use App\Services\Export\ExportDocumentBase;
use App\Services\ReportStorage;
final class PdfExport extends ExportDocumentBase
{
protected function handle(): string
{
$filename = $this->filename();
$filepath = ReportStorage::customFilepath($this->study, $filename);
if (ReportStorage::exists($this->study, $filename)) {
return $filepath;
}
$html = $this->report->getContent();
// todo: implement pdf generation
file_put_contents(ReportStorage::abspath($filepath), $html);
return $filepath;
}
protected function getExtension(): string
{
return ExportFormat::Pdf->value;
}
}