request->getPost(); $securityValidator = new SecurityValidator(); $securityValidator->checkVerifyCode($post['phone'], $post['verify_code']); $accountValidator = new AccountValidator(); $data = []; $data['phone'] = $accountValidator->checkPhone($post['phone']); $data['password'] = $accountValidator->checkPassword($post['password']); $accountValidator->checkIfPhoneTaken($post['phone']); $account = new AccountModel(); $account->create($data); return $account; } public function registerByEmail() { $post = $this->request->getPost(); $securityValidator = new SecurityValidator(); $securityValidator->checkVerifyCode($post['email'], $post['verify_code']); $accountValidator = new AccountValidator(); $data = []; $data['email'] = $accountValidator->checkEmail($post['email']); $data['password'] = $accountValidator->checkPassword($post['password']); $accountValidator->checkIfEmailTaken($post['email']); $account = new AccountModel(); $account->create($data); return $account; } }