Release 2.0.27 (#4107)

This commit is contained in:
Kevin Papst
2023-07-04 17:01:29 +02:00
committed by GitHub
parent 6a99ad41ca
commit 651f812da8
62 changed files with 506 additions and 427 deletions

View File

@@ -23,17 +23,10 @@ abstract class AbstractRenderer
/**
* @return string[]
*/
abstract protected function getFileExtensions();
abstract protected function getFileExtensions(): array;
/**
* @return string
*/
abstract protected function getContentType();
abstract protected function getContentType(): string;
/**
* @param InvoiceDocument $document
* @return bool
*/
public function supports(InvoiceDocument $document): bool
{
foreach ($this->getFileExtensions() as $extension) {
@@ -50,12 +43,7 @@ abstract class AbstractRenderer
return (string) new InvoiceFilename($model);
}
/**
* @param mixed $file
* @param string $filename
* @return BinaryFileResponse
*/
protected function getFileResponse($file, $filename)
protected function getFileResponse(mixed $file, string $filename): BinaryFileResponse
{
$response = new BinaryFileResponse($file);
$disposition = $response->headers->makeDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $filename);

View File

@@ -25,12 +25,8 @@ abstract class AbstractSpreadsheetRenderer extends AbstractRenderer
{
/**
* Saves the Spreadhseet and returns the filename.
*
* @param Spreadsheet $spreadsheet
* @return string
* @throws \Exception
*/
abstract protected function saveSpreadsheet(Spreadsheet $spreadsheet);
abstract protected function saveSpreadsheet(Spreadsheet $spreadsheet): string;
/**
* Render the given InvoiceDocument with the data from the InvoiceModel.

View File

@@ -25,7 +25,7 @@ final class XlsxRenderer extends AbstractSpreadsheetRenderer implements Renderer
return 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
}
protected function saveSpreadsheet(Spreadsheet $spreadsheet)
protected function saveSpreadsheet(Spreadsheet $spreadsheet): string
{
$filename = @tempnam(sys_get_temp_dir(), 'kimai-invoice-xlsx');
if (false === $filename) {