private function iterateTiers($tiers, &$result)
{
reset($tiers);
$uuid = key($tiers);
$tier = array_shift($tiers);
$found = false;
if (is_array($result)) {
foreach ($result as &$node) {
if ($node['id'] === $uuid) {
$node['_embedded']['nodes'] = $tier;
$found = true;
break;
}
}
}
if (!$tiers) {
return;
}
if (!$found) {
throw new \RuntimeException(sprintf('Could not find target node in with UUID "%s" in tier. This should not happen.', $uuid));
}
$this->iterateTiers($tiers, $node['_embedded']['nodes']);
}