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

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