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

27 lines
826 B
PHP

<?php
namespace App\Services\Export;
use App\Domain\Report\ExportFormat;
use App\Models\Study;
use App\Models\StudyReport;
use app\Services\Export\Formats\HtmlExport;
use app\Services\Export\Formats\PdfExport;
use app\Services\Export\Formats\Word2003Export;
use app\Services\Export\Formats\Word2007Export;
final readonly class Exporters
{
public static function make(Study $study, StudyReport $report, ExportFormat $format)
{
$exporter = match ($format) {
ExportFormat::Html => new HtmlExport($study, $report),
ExportFormat::Word2003 => new Word2003Export($study, $report),
ExportFormat::Word2007 => new Word2007Export($study, $report),
ExportFormat::Pdf => new PdfExport($study, $report),
};
return $exporter->make($study, $report);
}
}