Code Duplication    Length = 18-18 lines in 3 locations

src/Surfnet/StepupRa/RaBundle/Controller/RaLocationController.php 2 locations

@@ 89-106 (lines=18) @@
86
87
        $form = $this->createForm(CreateRaLocationType::class, $command)->handleRequest($request);
88
89
        if ($form->isSubmitted() && $form->isValid()) {
90
            $logger->debug('RA Location form submitted, start processing command');
91
92
            $success = $this->getRaLocationService()->create($command);
93
94
            if ($success) {
95
                $this->addFlash(
96
                    'success',
97
                    $this->get('translator')->trans('ra.create_ra_location.created')
98
                );
99
100
                $logger->debug('RA Location added, redirecting to the RA location overview');
101
                return $this->redirectToRoute('ra_locations_manage');
102
            }
103
104
            $logger->debug('RA Location creation failed, adding error to form');
105
            $this->addFlash('error', 'ra.create_ra_location.error.middleware_command_failed');
106
        }
107
108
        return $this->render('SurfnetStepupRaRaBundle:RaLocation:create.html.twig', [
109
            'form' => $form->createView()
@@ 150-167 (lines=18) @@
147
148
        $form = $this->createForm(ChangeRaLocationType::class, $command)->handleRequest($request);
149
150
        if ($form->isSubmitted() && $form->isValid()) {
151
            $logger->debug('RA Location form submitted, start processing command');
152
153
            $success = $this->getRaLocationService()->change($command);
154
155
            if ($success) {
156
                $this->addFlash(
157
                    'success',
158
                    $this->get('translator')->trans('ra.create_ra_location.changed')
159
                );
160
161
                $logger->debug('RA Location added, redirecting to the RA location overview');
162
                return $this->redirectToRoute('ra_locations_manage');
163
            }
164
165
            $logger->debug('RA Location creation failed, adding error to form');
166
            $this->addFlash('error', 'ra.create_ra_location.error.middleware_command_failed');
167
        }
168
169
        return $this->render('SurfnetStepupRaRaBundle:RaLocation:change.html.twig', [
170
            'form' => $form->createView()

src/Surfnet/StepupRa/RaBundle/Controller/RaManagementController.php 1 location

@@ 169-186 (lines=18) @@
166
167
        // todo: make choicelist configurable
168
        $form = $this->createForm(CreateRaType::class, $command)->handleRequest($request);
169
        if ($form->isSubmitted() && $form->isValid()) {
170
            $logger->debug('Accreditation form submitted, start processing command');
171
172
            $success = $this->getRaCandidateService()->accreditCandidate($command);
173
174
            if ($success) {
175
                $this->addFlash(
176
                    'success',
177
                    $this->get('translator')->trans('ra.management.create_ra.identity_accredited')
178
                );
179
180
                $logger->debug('Identity Accredited, redirecting to candidate overview');
181
                return $this->redirectToRoute('ra_management_ra_candidate_search');
182
            }
183
184
            $logger->debug('Identity Accreditation failed, adding error to form');
185
            $this->addFlash('error', 'ra.management.create_ra.error.middleware_command_failed');
186
        }
187
188
        return $this->render('SurfnetStepupRaRaBundle:RaManagement:createRa.html.twig', [
189
            'raCandidate' => $raCandidate,