jsonData = json_decode($json, true); } public function convertHTML(): void { foreach ($this->jsonData['data'] as $item) { if (isset($item["type"]) and isset($item["name"])) { /** * @var $builder Builder */ $builder = JsonInputMapper::getBuilder($item["type"]); unset($item["type"]); $name = $item["name"]; unset($item["name"]); $label = ''; if (isset($item['label'])) { $label = $this->createLabel($item['label']); } unset($item['label']); $input = $builder::build($name, $item); $input->setLabel($label)->create(); $this->html .= $input->fetch(); } } //return $this->fetch($html); } private function createLabel($labelParams) { $title = ''; if(isset($labelParams['title'])){ $title = $labelParams['title']; unset($labelParams['title']); } return LabelBuilder::build($title, $labelParams); } public function render(): void { echo $this->html; } }