Fix string formatting style in SavedExportController

Replaced double quotes with single quotes for consistency in exception messages and translatable strings. This change improves code readability and maintains uniformity across the file.
This commit is contained in:
Julien Fastré 2025-04-24 14:21:35 +02:00
parent d49058805a
commit a6e523ee0a
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB

View File

@ -118,7 +118,7 @@ final readonly class SavedExportController
public function duplicate(SavedExport $previousSavedExport, Request $request): Response public function duplicate(SavedExport $previousSavedExport, Request $request): Response
{ {
if (!$this->security->isGranted(SavedExportVoter::GENERATE, $previousSavedExport)) { if (!$this->security->isGranted(SavedExportVoter::GENERATE, $previousSavedExport)) {
throw new AccessDeniedHttpException("Not allowed to see this saved export"); throw new AccessDeniedHttpException('Not allowed to see this saved export');
} }
$user = $this->security->getUser(); $user = $this->security->getUser();
@ -135,7 +135,7 @@ final readonly class SavedExportController
->setTitle( ->setTitle(
$request->query->has('title') ? $request->query->has('title') ?
$request->query->get('title') : $request->query->get('title') :
$previousSavedExport->getTitle() . ' (' . $this->translator->trans('saved_export.Duplicated') . ' ' . (new \DateTimeImmutable('now'))->format('d-m-Y H:i:s') . ')' $previousSavedExport->getTitle().' ('.$this->translator->trans('saved_export.Duplicated').' '.(new \DateTimeImmutable('now'))->format('d-m-Y H:i:s').')'
); );
return $this->handleEdit($savedExport, $request); return $this->handleEdit($savedExport, $request);
@ -207,15 +207,15 @@ final readonly class SavedExportController
public function updateOptionsFromGeneration(SavedExport $savedExport, ExportGeneration $exportGeneration, Request $request): Response public function updateOptionsFromGeneration(SavedExport $savedExport, ExportGeneration $exportGeneration, Request $request): Response
{ {
if (!$this->security->isGranted(SavedExportVoter::EDIT, $savedExport)) { if (!$this->security->isGranted(SavedExportVoter::EDIT, $savedExport)) {
throw new AccessDeniedHttpException("You are not allowed to access this saved export"); throw new AccessDeniedHttpException('You are not allowed to access this saved export');
} }
if (!$this->security->isGranted(ExportGenerationVoter::VIEW, $exportGeneration)) { if (!$this->security->isGranted(ExportGenerationVoter::VIEW, $exportGeneration)) {
throw new AccessDeniedHttpException("You are not allowed to access this export generation"); throw new AccessDeniedHttpException('You are not allowed to access this export generation');
} }
if ($savedExport->getExportAlias() !== $exportGeneration->getExportAlias()) { if ($savedExport->getExportAlias() !== $exportGeneration->getExportAlias()) {
throw new UnprocessableEntityHttpException("export alias does not match"); throw new UnprocessableEntityHttpException('export alias does not match');
} }
$savedExport->setOptions($exportGeneration->getOptions()); $savedExport->setOptions($exportGeneration->getOptions());
@ -224,7 +224,7 @@ final readonly class SavedExportController
$session = $request->getSession(); $session = $request->getSession();
if ($session instanceof Session) { if ($session instanceof Session) {
$session->getFlashBag()->add('success', new TranslatableMessage("saved_export.Options updated successfully")); $session->getFlashBag()->add('success', new TranslatableMessage('saved_export.Options updated successfully'));
} }
return new RedirectResponse( return new RedirectResponse(