Code Duplication    Length = 17-17 lines in 2 locations

src/Kunstmaan/TranslatorBundle/Controller/TranslatorController.php 2 locations

@@ 99-115 (lines=17) @@
96
                $form->get('keyword')->addError($error);
97
            }
98
99
            if ($form->isSubmitted() && $form->isValid()) {
100
                // Create translation
101
                $em->getRepository(Translation::class)->createTranslations($data);
102
                $em->flush();
103
104
                $this->addFlash(
105
                    FlashTypes::SUCCESS,
106
                    $this->container->get('translator')->trans('settings.translator.succesful_added')
107
                );
108
109
                $indexUrl = $configurator->getIndexUrl();
110
111
                return new RedirectResponse($this->generateUrl(
112
                    $indexUrl['path'],
113
                    isset($indexUrl['params']) ? $indexUrl['params'] : []
114
                ));
115
            }
116
        }
117
118
        return [
@@ 168-184 (lines=17) @@
165
        if ($request->getMethod() === Request::METHOD_POST) {
166
            $form->handleRequest($request);
167
168
            if ($form->isSubmitted() && $form->isValid()) {
169
                // Update translations
170
                $em->getRepository(Translation::class)->updateTranslations($translation, $id);
171
                $em->flush();
172
173
                $this->addFlash(
174
                    FlashTypes::SUCCESS,
175
                    $this->container->get('translator')->trans('settings.translator.succesful_edited')
176
                );
177
178
                $indexUrl = $configurator->getIndexUrl();
179
180
                return new RedirectResponse($this->generateUrl(
181
                    $indexUrl['path'],
182
                    isset($indexUrl['params']) ? $indexUrl['params'] : []
183
                ));
184
            }
185
        }
186
187
        return [