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
            $form->addError(new FormError('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
            $form->addError(new FormError('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

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