feat: 实现TCP Server
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace app\flow\nodes;
|
||||
|
||||
use app\flow\ProcessContext;
|
||||
|
||||
/**
|
||||
* 流程节点接口
|
||||
* 责任链模式的核心接口
|
||||
*/
|
||||
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 bool
|
||||
*/
|
||||
public function canHandle(ProcessContext $context): bool;
|
||||
|
||||
/**
|
||||
* 是否启用该节点
|
||||
* @return bool
|
||||
*/
|
||||
public function isEnabled(): bool;
|
||||
|
||||
/**
|
||||
* 设置是否启用
|
||||
* @param bool $enabled
|
||||
* @return ProcessNodeInterface
|
||||
*/
|
||||
public function setEnabled(bool $enabled): ProcessNodeInterface;
|
||||
}
|
||||
Reference in New Issue
Block a user