private function buildNested(array
$rules, ?string
$parentId): array
{ $nested =
[];
foreach ($rules as $rule) { if ($rule['parent_id'
] !==
$parentId) { continue;
} if (!
$this->ruleConditionRegistry->
has($rule['type'
])) { throw new ConditionTypeNotFound($rule['type'
]);
} $ruleClass =
$this->ruleConditionRegistry->
getRuleClass($rule['type'
]);
$object =
new $ruleClass();
if ($object instanceof ScriptRule
) { $object->
assign([ 'script' =>
$rule['script'
] ?? '',
'lastModified' =>
$rule['lastModified'
] ?
new \
DateTimeImmutable($rule['lastModified'
]) : null,
'identifier' =>
$rule['identifier'
] ?? null,
'values' =>
$rule['value'
] ?
json_decode((string) $rule['value'
], true, 512, \JSON_THROW_ON_ERROR
) :
[],
]);