Files
tcpserver-flow/app/flow/strategies/ProcessStrategyInterface.php
T
2026-03-08 22:58:56 +08:00

42 lines
979 B
PHP

<?php
namespace app\flow\strategies;
use app\flow\ProcessContext;
use app\flow\nodes\ProcessNodeInterface;
/**
* 流程策略接口
* 策略模式的核心接口
*/
interface ProcessStrategyInterface
{
/**
* 执行策略
* @param ProcessContext $context 流程上下文
* @param ProcessNodeInterface $node 当前节点
* @return ProcessContext 处理后的上下文
*/
public function execute(ProcessContext $context, ProcessNodeInterface $node): ProcessContext;
/**
* 获取策略名称
* @return string
*/
public function getName(): string;
/**
* 获取策略执行阶段
* @return string 'before' | 'after'
*/
public function getPhase(): string;
/**
* 判断策略是否适用
* @param ProcessContext $context
* @param ProcessNodeInterface $node
* @return bool
*/
public function isApplicable(ProcessContext $context, ProcessNodeInterface $node): bool;
}