private function registrationChecks(UserDAO $userDAO, RegisterData $userRegData) { $password = password_hash($userRegData->getPassword(), PASSWORD_BCRYPT); if (password_verify($userRegData->getPasswordAgain(), $password)) { if (!$userDAO->doNicknameExistInDB($userRegData->getNickname())) { return true; } else { throw new CustomException("Unfortunately username you entered is already taken. :( Try another one!"); } } else { throw new CustomException("Passwords you entered do not match. :( Try again!"); } }
/** * This method gets users nickname * @param $userID * @return mixed */ public function getNicknameByID($userID) { $userDAO = new UserDAO(); return $userDAO->getNicknameByIDFromDB($userID); }