Files
zimoyin f2ff4ae123 ai-chore(config): 调整流程配置及改进测试代码
- 将 FLOW_USE_CUSTOM_PROCESS 从 true 改为 false,禁用自定义流程
- 在 BlockTest 测试用例中改用 setBlockMode 方法设置阻断模式
- 设置统一的错误处理,将错误转为异常抛出
- 重命名 BlockTest 测试文件路径,优化测试组织结构
- 更新 IDE php include paths,调整依赖包引用顺序
- 删除无用的 tests/flow/Test.php 测试文件
- 微调 start.php、webman、windows.php 配置或代码模块
2026-03-11 13:48:40 +08:00

112 lines
2.9 KiB
PHP

<?php
namespace app\flow\context\bean;
/**
* 提醒状态值对象
* 封装流程中的各类提醒标记(不可变)
*/
readonly class ReminderStatus
{
public function __construct(
/** 是否需要增强洗 */
public bool $needEnhanceWash = false,
/** 是否需要测漏提醒 */
public bool $needLeakTestRemind = false,
/** 是否需要存储提醒 */
public bool $needStorageRemind = false,
/** 是否已测漏 */
public bool $leakTestDone = false,
/** 测漏结果 */
public string $leakTestResult = '',
) {}
/**
* 创建默认状态(无提醒)
*/
public static function none(): self
{
return new self();
}
/**
* 设置需要增强洗
*/
public function withEnhanceWash(bool $need = true): self
{
return new self(
needEnhanceWash: $need,
needLeakTestRemind: $this->needLeakTestRemind,
needStorageRemind: $this->needStorageRemind,
leakTestDone: $this->leakTestDone,
leakTestResult: $this->leakTestResult
);
}
/**
* 设置需要测漏提醒
*/
public function withLeakTestRemind(bool $need = true): self
{
return new self(
needEnhanceWash: $this->needEnhanceWash,
needLeakTestRemind: $need,
needStorageRemind: $this->needStorageRemind,
leakTestDone: $this->leakTestDone,
leakTestResult: $this->leakTestResult
);
}
/**
* 设置需要存储提醒
*/
public function withStorageRemind(bool $need = true): self
{
return new self(
needEnhanceWash: $this->needEnhanceWash,
needLeakTestRemind: $this->needLeakTestRemind,
needStorageRemind: $need,
leakTestDone: $this->leakTestDone,
leakTestResult: $this->leakTestResult
);
}
/**
* 设置测漏完成
*/
public function withLeakTestDone(string $result = ''): self
{
return new self(
needEnhanceWash: $this->needEnhanceWash,
needLeakTestRemind: $this->needLeakTestRemind,
needStorageRemind: $this->needStorageRemind,
leakTestDone: true,
leakTestResult: $result
);
}
/**
* 是否有任何提醒
*/
public function hasAnyRemind(): bool
{
return $this->needEnhanceWash
|| $this->needLeakTestRemind
|| $this->needStorageRemind;
}
/**
* 转换为数组
*/
public function toArray(): array
{
return [
'needEnhanceWash' => $this->needEnhanceWash,
'needLeakTestRemind' => $this->needLeakTestRemind,
'needStorageRemind' => $this->needStorageRemind,
'leakTestDone' => $this->leakTestDone,
'leakTestResult' => $this->leakTestResult,
];
}
}