f2ff4ae123
- 将 FLOW_USE_CUSTOM_PROCESS 从 true 改为 false,禁用自定义流程 - 在 BlockTest 测试用例中改用 setBlockMode 方法设置阻断模式 - 设置统一的错误处理,将错误转为异常抛出 - 重命名 BlockTest 测试文件路径,优化测试组织结构 - 更新 IDE php include paths,调整依赖包引用顺序 - 删除无用的 tests/flow/Test.php 测试文件 - 微调 start.php、webman、windows.php 配置或代码模块
66 lines
1.5 KiB
PHP
66 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace app\flow\nodes;
|
|
|
|
use app\flow\context\ProcessContext;
|
|
use app\flow\context\bean\CanHandleResult;
|
|
|
|
/**
|
|
* 流程节点接口
|
|
* 责任链模式的核心接口
|
|
*/
|
|
interface ProcessNodeInterface
|
|
{
|
|
/**
|
|
* 设置下一个节点
|
|
* @param ProcessNodeInterface $next 下一个处理节点
|
|
* @return ProcessNodeInterface 返回自身,支持链式调用
|
|
*/
|
|
public function setNext(ProcessNodeInterface $next): ProcessNodeInterface;
|
|
|
|
/**
|
|
* 获取下一个节点
|
|
* @return ProcessNodeInterface|null
|
|
*/
|
|
public function getNext(): ?ProcessNodeInterface;
|
|
|
|
/**
|
|
* 处理流程
|
|
* @param ProcessContext $context 流程上下文
|
|
* @return ProcessContext 处理后的上下文
|
|
*/
|
|
public function handle(ProcessContext $context): ProcessContext;
|
|
|
|
/**
|
|
* 获取节点名称
|
|
* @return string
|
|
*/
|
|
public static function getName(): string;
|
|
|
|
/**
|
|
* 获取节点编码
|
|
* @return string
|
|
*/
|
|
public function getCode(): string;
|
|
|
|
/**
|
|
* 判断当前节点是否能处理该步骤
|
|
* @param ProcessContext $context
|
|
* @return CanHandleResult 包含是否能处理以及期望下一步的结果
|
|
*/
|
|
public function canHandle(ProcessContext $context): CanHandleResult;
|
|
|
|
/**
|
|
* 是否启用该节点
|
|
* @return bool
|
|
*/
|
|
public function isEnabled(): bool;
|
|
|
|
/**
|
|
* 设置是否启用
|
|
* @param bool $enabled
|
|
* @return ProcessNodeInterface
|
|
*/
|
|
public function setEnabled(bool $enabled): ProcessNodeInterface;
|
|
}
|