More cleanup PHPDoc according to PhpStorm

This commit is contained in:
Adrien Crivelli
2024-01-03 21:12:55 +08:00
parent c1eafc5336
commit aefde297df
4 changed files with 12 additions and 22 deletions
+8 -15
View File
@@ -16,27 +16,20 @@ $spreadsheet->getActiveSheet()->setPrintGridlines(true);
$helper->write($spreadsheet, __FILE__, ['Xlsx', 'Xls', 'Html']);
// Export to PDF (mpdf)
function mpdfCjkWriter(Mpdf $writer): void
{
/** @var callable */
$callback = 'mpdfCjk';
$writer->setEditHtmlCallback($callback);
}
$mpdfCjkWriter = function (Mpdf $writer): void {
$mpdfCjk = function (string $html): string {
$html = str_replace("'Calibri'", "'Calibri',Sun-ExtA", $html);
function mpdfCjk(string $html): string
{
$html = str_replace("'Calibri'", "'Calibri',Sun-ExtA", $html);
return str_replace("'Times New Roman'", "'Times New Roman',Sun-ExtA", $html);
};
return str_replace("'Times New Roman'", "'Times New Roman',Sun-ExtA", $html);
}
$writer->setEditHtmlCallback($mpdfCjk);
};
$helper->log('Write to Mpdf');
IOFactory::registerWriter('Pdf', Mpdf::class);
/** @var callable */
$callback = 'mpdfCjkWriter';
$filename = __FILE__;
//$filename = str_replace('.php', '.mdpf.php', __FILE__);
$helper->write($spreadsheet, $filename, ['Pdf'], false, $callback);
$helper->write($spreadsheet, $filename, ['Pdf'], false, $mpdfCjkWriter);
// Remove first two rows with field headers before exporting to CSV
$helper->log('Removing first two heading rows for CSV export');