70 lines
1.4 KiB
PHP
70 lines
1.4 KiB
PHP
<?php
|
||
|
||
namespace app\flow\config;
|
||
|
||
/**
|
||
* 流程步骤配置类
|
||
* 描述责任链中的单个节点
|
||
*/
|
||
class StepConfig extends AbstractConfig
|
||
{
|
||
/**
|
||
* 步骤标识码(如 '清洗'、'漂洗')
|
||
*/
|
||
public string $code {
|
||
get => $this->code;
|
||
}
|
||
|
||
/**
|
||
* 节点类名(不含命名空间)
|
||
*/
|
||
public string $class {
|
||
get => $this->class;
|
||
}
|
||
|
||
/**
|
||
* 是否启用
|
||
*/
|
||
public bool $enabled {
|
||
get => $this->enabled;
|
||
set => $this->enabled = $value;
|
||
}
|
||
|
||
/**
|
||
* 扩展字段(用于原始/自定义字段透传)
|
||
*/
|
||
public array $expand {
|
||
get => $this->expand;
|
||
}
|
||
|
||
/**
|
||
* @var array 需要上一个节点
|
||
*/
|
||
public array $required = [];
|
||
|
||
public function __construct(
|
||
string $code,
|
||
string $class,
|
||
bool $enabled = true,
|
||
array $required = [],
|
||
array $expand = []
|
||
)
|
||
{
|
||
$this->code = $code;
|
||
$this->class = $class;
|
||
$this->enabled = $enabled;
|
||
$this->required = $required;
|
||
$this->expand = $expand;
|
||
}
|
||
|
||
public function toArray(): array
|
||
{
|
||
return array_merge([
|
||
'code' => $this->code,
|
||
'class' => $this->class,
|
||
'enabled' => $this->enabled,
|
||
'required' => $this->required,
|
||
], $this->expand);
|
||
}
|
||
}
|