request->getPost(); $verifyValidator = new VerifyValidator(); $verifyValidator->checkCode($post['account'], $post['verify_code']); $accountValidator = new AccountValidator(); $data = []; if (CommonValidator::email($post['account'])) { $data['email'] = $accountValidator->checkEmail($post['account']); $accountValidator->checkIfEmailTaken($post['account']); } elseif (CommonValidator::phone($post['account'])) { $data['phone'] = $accountValidator->checkPhone($post['account']); $accountValidator->checkIfPhoneTaken($post['account']); } $data['password'] = $accountValidator->checkPassword($post['password']); $account = new AccountModel(); $account->create($data); $userRepo = new UserRepo(); return $userRepo->findById($account->id); } }