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