public function doRegisterAction() { if ($this->registerView->userPressedRegister()) { try { $registrationCredentials = $this->registerView->getRegistrationCredentials(); if ($registrationCredentials == null) { return; } $this->registerModel->registerUser($registrationCredentials); $this->registerView->setRegistrationSuccess(); } catch (\common\UsernameTakenException $e) { $this->registerView->setRegistrationFailed(); } catch (\Exception $e) { $this->registerView->setDatabaseError(); } } }