Files
2026-03-08 22:58:56 +08:00

70 lines
1.4 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?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);
}
}