Files
tcpserver-flow/app/flow/vo/ReminderStatus.php
T
zimoyin d5991813a6 ai-refactor(flow): 调整抽象流程节点实现和依赖路径
- 修改 AbstractProcessNode 中 ProcessContext 的命名空间引用为 app\flow\context\ProcessContext
- 引入 app\flow\vo\CanHandleResult 用于节点处理结果表示
- 更新前置策略执行后对成功状态的判断,改为调用 isSuccess() 方法
- 增加日志记录细节,便于调试策略执行中断时的错误信息
- 优化代码注释,提升代码可读性和维护性
2026-03-11 00:49:02 +08:00

112 lines
2.9 KiB
PHP

<?php
namespace app\flow\vo;
/**
* 提醒状态值对象
* 封装流程中的各类提醒标记(不可变)
*/
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,
];
}
}