private function doParseChildren(array $children) { $parsedChildren = array(); foreach ($children as $child) { if (!array_key_exists("type", $child)) { // @codeCoverageIgnoreStart continue; // @codeCoverageIgnoreEnd } $block = BlockFactory::createBlock($child["type"]); $encodedBlock = $this->serializer->serialize($block, 'json'); $updatedBlock = JsonTools::join($encodedBlock, $child); $block = $this->serializer->deserialize(json_encode($updatedBlock), get_class($block), 'json'); $block->updateSource(); $children = json_decode($this->serializer->serialize($block, 'json'), true); if (array_key_exists("children", $children)) { $children["children"] = $this->doParseChildren($children["children"]); } $parsedChildren[] = $children; } return $parsedChildren; }