Code Duplication    Length = 7-8 lines in 2 locations

src/system/UsersModule/Controller/RegistrationController.php 1 location

@@ 149-156 (lines=8) @@
146
                    $formData['id'] = $authenticationMethodId;
147
                    $formData['uid'] = $userEntity->getUid();
148
                    $externalRegistrationSuccess = $authenticationMethod->register($formData);
149
                    if (true !== $externalRegistrationSuccess) {
150
                        // revert registration
151
                        $this->addFlash('error', $this->__('The registration process failed.'));
152
                        $this->get('zikula_users_module.user_repository')->removeAndFlush($userEntity);
153
                        $dispatcher->dispatch(RegistrationEvents::DELETE_REGISTRATION, new GenericEvent($userEntity->getUid()));
154
155
                        return $this->redirectToRoute('zikulausersmodule_registration_register'); // try again.
156
                    }
157
                    $formDataEvent = new UserFormDataEvent($userEntity, $form);
158
                    $dispatcher->dispatch(UserEvents::EDIT_FORM_HANDLE, $formDataEvent);
159
                    $hookDispatcher->dispatch(HookContainer::REGISTRATION_PROCESS, new ProcessHook($userEntity->getUid()));

src/system/ZAuthModule/Controller/UserAdministrationController.php 1 location

@@ 171-177 (lines=7) @@
168
                    $this->addFlash('error', implode('<br>', $notificationErrors));
169
                }
170
                $mapping->setUid($user->getUid());
171
                if (!$authMethod->register($mapping->toArray())) {
172
                    $this->addFlash('error', $this->__('The create process failed for an unknown reason.'));
173
                    $this->get('zikula_users_module.user_repository')->removeAndFlush($user);
174
                    $dispatcher->dispatch(RegistrationEvents::DELETE_REGISTRATION, new GenericEvent($user->getUid()));
175
176
                    return $this->redirectToRoute('zikulazauthmodule_useradministration_list');
177
                }
178
                $formDataEvent = new UserFormDataEvent($user, $form);
179
                $dispatcher->dispatch(UserEvents::EDIT_FORM_HANDLE, $formDataEvent);
180
                $hook = new ProcessHook($user->getUid());