refactor(context): 重命名上下文构建器及更新相关方法命名
- 将 ProcessContext 中的 builder() 重命名为 createModifyBuilder() 并添加调用栈日志 - ProcessContextBuilder 中所有 with* 方法统一改为 set* 命名风格 - Flow 各节点及流程处理器中调用 builder() 替换为 createModifyBuilder() - 虚拟测试环境相关 ContextBuilder 中方法同步改名保持一致 - 优化流程节点中上下文修改代码调用,提升代码规范性 - 添加Config中加载自定义流程配置的占位注释及代码 - 无功能改动,纯代码风格及命名规范调整
This commit is contained in:
@@ -41,7 +41,7 @@ class MorningWashStrategy extends AbstractStrategy
|
||||
todayWashRecords: $context->getMorningWash()->todayWashRecords
|
||||
);
|
||||
|
||||
return $context->builder()->withMorningWash($morningWash)->build();
|
||||
return $context->createModifyBuilder()->setMorningWash($morningWash)->build();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -79,7 +79,7 @@ class TimeValidationStrategy extends AbstractStrategy
|
||||
// 从数据库按流程类型精确查询
|
||||
$requiredDuration = $this->getDurationFromDb($stepCode, $processType);
|
||||
if ($requiredDuration > 0) {
|
||||
$context = $context->builder()->withStepDuration($stepCode, $requiredDuration)->build();
|
||||
$context = $context->createModifyBuilder()->setStepDuration($stepCode, $requiredDuration)->build();
|
||||
} else {
|
||||
// 最后使用上下文已缓存值
|
||||
$requiredDuration = $context->getStepDuration($stepCode);
|
||||
@@ -106,7 +106,7 @@ class TimeValidationStrategy extends AbstractStrategy
|
||||
$voice = VoiceMessage::NOT_ENOUGH_TIME->value;
|
||||
$voice = str_replace('{step}', $stepCode, $voice);
|
||||
$voice = str_replace('{time}', $requiredDuration - $duration, $voice);
|
||||
$context = $context->builder()->customError($voice)->build();
|
||||
$context = $context->createModifyBuilder()->setCustomError($voice)->build();
|
||||
}
|
||||
return $context;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ class VoiceGenerationStrategy extends AbstractStrategy
|
||||
"流程中存在自定义语音或存在多次设置语音,语音应该在 VoiceGenerationStrategy 策略中配置,否则不能拦截与自定义配置",
|
||||
new IllegalUsageException("In the existing process, there is custom voice, which should be configured in the VoiceGenerationStrategy strategy; otherwise, it cannot be intercepted and customized")
|
||||
);
|
||||
return $context->builder()->voiceMessage($context->getVoice()->message)->build();
|
||||
return $context->createModifyBuilder()->setVoiceMessage($context->getVoice()->message)->build();
|
||||
}
|
||||
|
||||
// 如果已经有错误,生成错误语音
|
||||
@@ -56,7 +56,7 @@ class VoiceGenerationStrategy extends AbstractStrategy
|
||||
}
|
||||
Logger::debug("应用语音模板后的内容: {$voice}");
|
||||
|
||||
return $context->builder()->voiceMessage($voice)->build();
|
||||
return $context->createModifyBuilder()->setVoiceMessage($voice)->build();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user