-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
its currently broken, but lots of work towards better xml serialization
- Loading branch information
Showing
19 changed files
with
545 additions
and
230 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<?php declare(strict_types=1); | ||
|
||
/* | ||
* Copyright 2025 Daniel Carbone ([email protected]) | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/** @var \DCarbone\PHPFHIR\Config $config */ | ||
/** @var \DCarbone\PHPFHIR\CoreFile $coreFile */ | ||
|
||
use DCarbone\PHPFHIR\Utilities\ImportUtils; | ||
|
||
$coreFiles = $config->getCoreFiles(); | ||
|
||
$typeInterface = $coreFiles->getCoreFileByEntityName(PHPFHIR_TYPES_INTERFACE_TYPE); | ||
$serializeConfigClass = $coreFiles->getCoreFileByEntityName(PHPFHIR_ENCODING_CLASSNAME_SERIALIZE_CONFIG); | ||
$unserializeConfigClass = $coreFiles->getCoreFileByEntityName(PHPFHIR_ENCODING_CLASSNAME_UNSERIALIZE_CONFIG); | ||
$xmlWriterClass = $coreFiles->getCoreFileByEntityName(PHPFHIR_ENCODING_CLASSNAME_XML_WRITER); | ||
|
||
$imports = $coreFile->getimports(); | ||
|
||
$imports->addCoreFileImports($typeInterface, $serializeConfigClass, $unserializeConfigClass, $xmlWriterClass); | ||
|
||
ob_start(); | ||
echo '<?php ';?>declare(strict_types=1); | ||
|
||
namespace <?php echo $coreFile->getFullyQualifiedNamespace(false); ?>; | ||
|
||
<?php echo $config->getBasePHPFHIRCopyrightComment(true); ?> | ||
|
||
<?php echo ImportUtils::compileImportStatements($imports); ?> | ||
|
||
interface <?php echo $coreFile->getEntityName(); ?> extends <?php echo $typeInterface->getEntityName(); ?>, \JsonSerializable | ||
|
||
{ | ||
/** | ||
* Returns the root XMLNS value found in the source. Null indicates no "xmlns" was found. Only defined when | ||
* unserializing XML, and only used when serializing XML. | ||
* | ||
* @return null|string | ||
*/ | ||
public function _getSourceXMLNS(): null|string; | ||
|
||
/** | ||
* @param string|\SimpleXMLElement $element | ||
* @param null|<?php echo $coreFile->getFullyQualifiedName(true); ?> $type Instance of this class to unserialize into. If left null, a new instance will be created. | ||
* @param null|<?php echo $unserializeConfigClass->getFullyQualifiedName(true); ?> $config | ||
* @return static | ||
*/ | ||
public static function xmlUnserialize(string|\SimpleXMLElement $element, | ||
null|<?php echo $coreFile->getEntityName(); ?> $type = null, | ||
null|<?php echo $unserializeConfigClass->getEntityName() ?> $config = null): self; | ||
|
||
/** | ||
* @param null|<?php echo $xmlWriterClass->getFullyQualifiedName(true); ?> $xw | ||
* @param null|<?php echo $serializeConfigClass->getFullyQualifiedName(true); ?> $config | ||
* @return <?php echo $xmlWriterClass->getFullyQualifiedName(true); ?> | ||
|
||
*/ | ||
public function xmlSerialize(null|<?php echo $xmlWriterClass->getEntityName(); ?> $xw = null, | ||
null|<?php echo $serializeConfigClass->getEntityName(); ?> $config = null): <?php echo $xmlWriterClass->getEntityName(); ?>; | ||
|
||
/** | ||
* @param string|array|\stdClass $json Raw or already un-encoded JSON | ||
* @param null|<?php echo $coreFile->getFullyQualifiedName(true); ?> $type Instance of this class to unserialize into. If left null, a new instance will be created. | ||
* @param null|<?php echo $unserializeConfigClass->getFullyQualifiedName(true); ?> $config | ||
* @return static | ||
*/ | ||
public static function jsonUnserialize(string|array|\stdClass $json, | ||
null|<?php echo $coreFile->getEntityName(); ?> $type = null, | ||
null|<?php echo $unserializeConfigClass->getEntityName(); ?> $config = null): self; | ||
} | ||
|
||
<?php return ob_get_clean(); |
Oops, something went wrong.