These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Kunstmaan\TranslatorBundle\Controller; |
||
4 | |||
5 | use Kunstmaan\AdminBundle\FlashMessages\FlashTypes; |
||
6 | use Kunstmaan\TranslatorBundle\Model\Export\ExportCommand; |
||
7 | use Kunstmaan\TranslatorBundle\Model\Import\ImportCommand; |
||
8 | use Symfony\Component\Routing\Annotation\Route; |
||
9 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; |
||
10 | use Symfony\Component\HttpFoundation\RedirectResponse; |
||
11 | |||
12 | class TranslatorCommandController extends Controller |
||
0 ignored issues
–
show
|
|||
13 | { |
||
14 | /** |
||
15 | * @Route("/clear-cache", name="KunstmaanTranslatorBundle_command_clear_cache") |
||
16 | */ |
||
17 | public function clearCacheAction() |
||
18 | { |
||
19 | $this->get('kunstmaan_translator.service.translator.resource_cacher')->flushCache(); |
||
20 | $this->addFlash( |
||
21 | FlashTypes::SUCCESS, |
||
22 | $this->get('translator')->trans('kuma_translator.command.clear.flash.success') |
||
23 | ); |
||
24 | |||
25 | return new RedirectResponse($this->generateUrl('KunstmaanTranslatorBundle_settings_translations')); |
||
26 | } |
||
27 | |||
28 | /** |
||
29 | * @Route("/import", name="KunstmaanTranslatorBundle_command_import") |
||
30 | */ |
||
31 | View Code Duplication | public function importAction() |
|
32 | { |
||
33 | $importCommand = new ImportCommand(); |
||
34 | $importCommand |
||
35 | ->setForce(false) |
||
36 | ->setDefaultBundle($this->getParameter('kuma_translator.default_bundle')) |
||
37 | ->setBundles($this->getParameter('kuma_translator.bundles')) |
||
38 | ->setGlobals(true); |
||
39 | |||
40 | $this->get('kunstmaan_translator.service.importer.command_handler')->executeImportCommand($importCommand); |
||
41 | |||
42 | $this->addFlash( |
||
43 | FlashTypes::SUCCESS, |
||
44 | $this->get('translator')->trans('kuma_translator.command.import.flash.success') |
||
45 | ); |
||
46 | |||
47 | return new RedirectResponse($this->generateUrl('KunstmaanTranslatorBundle_settings_translations')); |
||
48 | } |
||
49 | |||
50 | /** |
||
51 | * @Route("/import-forced", name="KunstmaanTranslatorBundle_command_import_forced") |
||
52 | */ |
||
53 | View Code Duplication | public function importForcedAction() |
|
54 | { |
||
55 | $importCommand = new ImportCommand(); |
||
56 | $importCommand |
||
57 | ->setForce(true) |
||
58 | ->setDefaultBundle($this->getParameter('kuma_translator.default_bundle')) |
||
59 | ->setBundles($this->getParameter('kuma_translator.bundles')) |
||
60 | ->setGlobals(false); |
||
61 | |||
62 | $this->get('kunstmaan_translator.service.importer.command_handler')->executeImportCommand($importCommand); |
||
63 | |||
64 | $this->addFlash( |
||
65 | FlashTypes::SUCCESS, |
||
66 | $this->get('translator')->trans('kuma_translator.command.import.flash.force_success') |
||
67 | ); |
||
68 | |||
69 | return new RedirectResponse($this->generateUrl('KunstmaanTranslatorBundle_settings_translations')); |
||
70 | } |
||
71 | |||
72 | /** |
||
73 | * @Route("/export", name="KunstmaanTranslatorBundle_command_export") |
||
74 | */ |
||
75 | public function exportAction() |
||
76 | { |
||
77 | $locales = $this->getParameter('kuma_translator.managed_locales'); |
||
78 | $exportCommand = new ExportCommand(); |
||
79 | $exportCommand |
||
80 | ->setLocales($locales) |
||
81 | ->setFormat('csv'); |
||
82 | |||
83 | $response = $this->get('kunstmaan_translator.service.exporter.command_handler')->executeExportCSVCommand($exportCommand); |
||
84 | |||
85 | return $response; |
||
86 | } |
||
87 | } |
||
88 |
This class, trait or interface has been deprecated. The supplier of the file has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the type will be removed from the class and what other constant to use instead.