} /**
* @param ArrayStruct<string, mixed> $flagBag
*/
private function createNestedIf(array
$currentSequence, ArrayStruct
$flagBag): Sequence
{ $sequenceChildren =
$currentSequence['children'
];
if (!
$sequenceChildren) { // a dummy if with no false and true case
return Sequence::
createIF($currentSequence['rule_id'
],
$currentSequence['flow_id'
],
$currentSequence['sequence_id'
], null, null
);
} $trueCases =
array_filter($sequenceChildren,
fn (array
$sequence) =>
(bool) $sequence['true_case'
] === true
);
$falseCases =
array_filter($sequenceChildren,
fn (array
$sequence) =>
(bool) $sequence['true_case'
] === false
);
$trueCaseSequence = null;
if (!
empty($trueCases)) { $trueCase =
array_shift($trueCases);
$trueCaseSequence =
$this->
createNestedSequence($trueCase,
$trueCases,
$flagBag);
}