d5991813a6
- 修改 AbstractProcessNode 中 ProcessContext 的命名空间引用为 app\flow\context\ProcessContext - 引入 app\flow\vo\CanHandleResult 用于节点处理结果表示 - 更新前置策略执行后对成功状态的判断,改为调用 isSuccess() 方法 - 增加日志记录细节,便于调试策略执行中断时的错误信息 - 优化代码注释,提升代码可读性和维护性
64 lines
1.2 KiB
PHP
64 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace app\flow\vo;
|
|
|
|
/**
|
|
* 读卡器信息值对象
|
|
* 封装读卡器的基础信息,不可变对象
|
|
*/
|
|
readonly class ReaderInfo
|
|
{
|
|
public function __construct(
|
|
/** 读卡器编号 */
|
|
public string $no = '',
|
|
/** 读卡器类型/功能(清洗/漂洗/消毒等) */
|
|
public string $type = '',
|
|
/** 读卡器ID */
|
|
public string $id = '',
|
|
) {}
|
|
|
|
/**
|
|
* 创建空的读卡器信息
|
|
*/
|
|
public static function empty(): self
|
|
{
|
|
return new self();
|
|
}
|
|
|
|
/**
|
|
* 判断读卡器信息是否为空
|
|
*/
|
|
public function isEmpty(): bool
|
|
{
|
|
return empty($this->no);
|
|
}
|
|
|
|
/**
|
|
* 判断读卡器类型是否匹配
|
|
*/
|
|
public function isType(string $type): bool
|
|
{
|
|
return $this->type === $type;
|
|
}
|
|
|
|
/**
|
|
* 判断读卡器类型是否在给定列表中
|
|
*/
|
|
public function isTypeIn(array $types): bool
|
|
{
|
|
return in_array($this->type, $types, true);
|
|
}
|
|
|
|
/**
|
|
* 转换为数组
|
|
*/
|
|
public function toArray(): array
|
|
{
|
|
return [
|
|
'no' => $this->no,
|
|
'type' => $this->type,
|
|
'id' => $this->id,
|
|
];
|
|
}
|
|
}
|