function setFatalErrorResponse() { $lastError = error_get_last(); if ($lastError !== null) { ob_clean(); setErrorResponse($lastError); } }
public function register($request) { $user = new User(); $user->applyValuesFromArray($request); if ($user->validate($this->userRepository, $request["passwordConfirm"])) { $this->userRepository->insert($user); } else { setErrorResponse("Validation error occured."); } }