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

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