30 lines
726 B
PHP
30 lines
726 B
PHP
<?php
|
|
|
|
namespace app\Services\Export\Formats;
|
|
|
|
use App\Domain\Report\ExportFormat;
|
|
use App\Services\Export\ExportDocumentBase;
|
|
use App\Services\ReportStorage;
|
|
|
|
final class HtmlExport 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();
|
|
file_put_contents(ReportStorage::abspath($filepath), $html);
|
|
|
|
return $filepath;
|
|
}
|
|
|
|
protected function getExtension(): string
|
|
{
|
|
return ExportFormat::Html->value;
|
|
}
|
|
}
|