sId = $oDomNode->getAttribute('id'); $this->sParentType = $oDomNode->GetChildText('extends', ''); $oDefinitionNode = $oDomNode->GetUniqueElement('definition'); $sDefinitionNodeType = $oDefinitionNode->getAttribute('xsi:type'); if (!is_a($sDefinitionNodeType, AbstractValueType::class, true)) { throw new PropertyTypeException('Unsupported xsi:type '.json_encode($sDefinitionNodeType), $oDomNode); } $this->oValueType = new $sDefinitionNodeType(); $this->oValueType->SetRootId($this->sId); $this->oValueType->InitFromDomNode($oDefinitionNode); } public function ToPHPFormBlock(): string { $aPHPFragments = []; if ($this->oValueType->IsLeaf()) { $sFormBlockClass = $this->oValueType->GetFormBlockClass(); $sLocalPHP = <<sId extends $sFormBlockClass { } PHP; $aPHPFragments[] = $sLocalPHP; } else { $this->oValueType->ToPHPFormBlock($aPHPFragments); } return implode("\n\n", $aPHPFragments); } public function GetParentType(): string { return $this->sParentType; } public function SerializeToDOMNode(mixed $value, DesignElement$oDOMNode): void { $this->oValueType->SerializeToDOMNode($value, $oDOMNode); } public function UnserializeFromDOMNode(DesignElement $oDOMNode): mixed { return $this->oValueType->UnserializeFromDOMNode($oDOMNode); } }