Code Duplication    Length = 18-18 lines in 3 locations

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

@@ 82-99 (lines=18) @@
79
80
        $form = $this->createForm('ra_create_ra_location', $command)->handleRequest($request);
81
82
        if ($form->isValid()) {
83
            $logger->debug('RA Location form submitted, start processing command');
84
85
            $success = $this->getRaLocationService()->create($command);
86
87
            if ($success) {
88
                $this->addFlash(
89
                    'success',
90
                    $this->get('translator')->trans('ra.create_ra_location.created')
91
                );
92
93
                $logger->debug('RA Location added, redirecting to the RA location overview');
94
                return $this->redirectToRoute('ra_locations_manage');
95
            }
96
97
            $logger->debug('RA Location creation failed, adding error to form');
98
            $form->addError(new FormError('ra.create_ra_location.error.middleware_command_failed'));
99
        }
100
101
        return $this->render('SurfnetStepupRaRaBundle:RaLocation:create.html.twig', [
102
            'form' => $form->createView()
@@ 143-160 (lines=18) @@
140
141
        $form = $this->createForm('ra_change_ra_location', $command)->handleRequest($request);
142
143
        if ($form->isValid()) {
144
            $logger->debug('RA Location form submitted, start processing command');
145
146
            $success = $this->getRaLocationService()->change($command);
147
148
            if ($success) {
149
                $this->addFlash(
150
                    'success',
151
                    $this->get('translator')->trans('ra.create_ra_location.changed')
152
                );
153
154
                $logger->debug('RA Location added, redirecting to the RA location overview');
155
                return $this->redirectToRoute('ra_locations_manage');
156
            }
157
158
            $logger->debug('RA Location creation failed, adding error to form');
159
            $form->addError(new FormError('ra.create_ra_location.error.middleware_command_failed'));
160
        }
161
162
        return $this->render('SurfnetStepupRaRaBundle:RaLocation:change.html.twig', [
163
            'form' => $form->createView()

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

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