From 65074a3548b3fe32158f9cf1e1be4a6325c0f4e6 Mon Sep 17 00:00:00 2001 From: Daniel Carbone Date: Sat, 28 Dec 2024 17:46:48 -0600 Subject: [PATCH] much better determination of 'special' dstu1 stuff --- composer.json | 3 +- composer.lock | 87 ++++++++++++++++++- src/Enum/TypeKindEnum.php | 32 +++---- src/Version.php | 19 ++-- ...ionDefaultConfig.php => DefaultConfig.php} | 8 +- ...igKeyEnum.php => DefaultConfigKeyEnum.php} | 2 +- src/Version/Definition.php | 2 +- src/Version/Definition/TypeDecorator.php | 26 +++--- src/Version/Definition/Types.php | 9 +- src/Version/SourceMetadata.php | 15 +++- .../versions/core/classes/class_version.php | 2 +- .../core/classes/class_version_type_map.php | 2 +- .../interface_version_contained_type.php | 2 +- .../types/properties/methods/default.php | 2 +- .../serialization/xml/serialize/body.php | 2 +- .../types/tests/integration/class.php | 2 +- .../versions/types/tests/validation/class.php | 8 +- 17 files changed, 160 insertions(+), 63 deletions(-) rename src/Version/{VersionDefaultConfig.php => DefaultConfig.php} (94%) rename src/Version/{VersionDefaultConfigKeyEnum.php => DefaultConfigKeyEnum.php} (95%) diff --git a/composer.json b/composer.json index c8b7bb33..98e736f7 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,8 @@ "ext-simplexml": "*", "ext-xmlreader": "*", "ext-xmlwriter": "*", - "psr/log": "^3.0" + "psr/log": "^3.0", + "composer/semver": "^3.4" }, "require-dev": { "phpunit/phpunit": "^10.5 || ^11.0", diff --git a/composer.lock b/composer.lock index 61b81517..fd6d6b94 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,89 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "4857d98be3081de3d5aec319bae434bf", + "content-hash": "62264fb6e427821b78fda5dcc603f221", "packages": [ + { + "name": "composer/semver", + "version": "3.4.3", + "source": { + "type": "git", + "url": "https://github.com/composer/semver.git", + "reference": "4313d26ada5e0c4edfbd1dc481a92ff7bff91f12" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/semver/zipball/4313d26ada5e0c4edfbd1dc481a92ff7bff91f12", + "reference": "4313d26ada5e0c4edfbd1dc481a92ff7bff91f12", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^1.11", + "symfony/phpunit-bridge": "^3 || ^7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Semver\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" + } + ], + "description": "Semver library that offers utilities, version constraint parsing and validation.", + "keywords": [ + "semantic", + "semver", + "validation", + "versioning" + ], + "support": { + "irc": "ircs://irc.libera.chat:6697/composer", + "issues": "https://github.com/composer/semver/issues", + "source": "https://github.com/composer/semver/tree/3.4.3" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2024-09-19T14:15:21+00:00" + }, { "name": "psr/log", "version": "3.0.2", @@ -1788,7 +1869,7 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": {}, "prefer-stable": false, "prefer-lowest": false, "platform": { @@ -1802,6 +1883,6 @@ "ext-xmlreader": "*", "ext-xmlwriter": "*" }, - "platform-dev": [], + "platform-dev": {}, "plugin-api-version": "2.6.0" } diff --git a/src/Enum/TypeKindEnum.php b/src/Enum/TypeKindEnum.php index cdc2ac73..8ca62faa 100644 --- a/src/Enum/TypeKindEnum.php +++ b/src/Enum/TypeKindEnum.php @@ -18,6 +18,8 @@ * limitations under the License. */ +use DCarbone\PHPFHIR\Version; + enum TypeKindEnum: string { // this represents an actual value: string, int, etc. @@ -46,20 +48,23 @@ enum TypeKindEnum: string // treated a bit different case PHPFHIR_XHTML = 'phpfhir_xhtml'; - private const CONTAINER_TYPES = [ - self::RESOURCE_CONTAINER, - self::RESOURCE_INLINE, - ]; + private const _DSTU1_CONTAINER_TYPE = self::RESOURCE_INLINE; + + private const _CONTAINER_TYPE = self::RESOURCE_CONTAINER; /** * Returns true if the provided FHIR type name is the "container" type for the provided version. * + * @param \DCarbone\PHPFHIR\Version $version * @param string $fhirName * @return bool */ - public static function isContainerTypeName(string $fhirName): bool + public static function isContainerTypeName(Version $version, string $fhirName): bool { - return in_array($fhirName, self::_containerTypeStrings(), true); + if ($version->getSourceMetadata()->isDSTU1()) { + return $fhirName === self::_DSTU1_CONTAINER_TYPE->value; + } + return $fhirName === self::_CONTAINER_TYPE->value; } /** @@ -74,17 +79,14 @@ public function isOneOf(TypeKindEnum|string ...$other): bool /** * Returns true if this kind is the "container" kind for the provided FHIR version. * + * @param \DCarbone\PHPFHIR\Version $version * @return bool */ - public function isContainer(): bool - { - return in_array($this, self::CONTAINER_TYPES, true); - } - - private static function _containerTypeStrings(): array + public function isContainer(Version $version): bool { - return array_map(function (TypeKindEnum $tk): string { - return $tk->value; - }, self::CONTAINER_TYPES); + if ($version->getSourceMetadata()->isDSTU1()) { + return $this === self::_DSTU1_CONTAINER_TYPE; + } + return $this === self::_CONTAINER_TYPE; } } \ No newline at end of file diff --git a/src/Version.php b/src/Version.php index d6c4fc07..8e095258 100644 --- a/src/Version.php +++ b/src/Version.php @@ -18,11 +18,12 @@ * limitations under the License. */ +use Composer\Semver\Semver; use DCarbone\PHPFHIR\Enum\TestTypeEnum; use DCarbone\PHPFHIR\Utilities\NameUtils; use DCarbone\PHPFHIR\Version\SourceMetadata; use DCarbone\PHPFHIR\Version\Definition; -use DCarbone\PHPFHIR\Version\VersionDefaultConfig; +use DCarbone\PHPFHIR\Version\DefaultConfig; /** * Class Version @@ -36,8 +37,8 @@ class Version /** @var \DCarbone\PHPFHIR\Version\SourceMetadata */ private SourceMetadata $_sourceMetadata; - /** @var \DCarbone\PHPFHIR\Version\VersionDefaultConfig */ - private VersionDefaultConfig $_defaultConfig; + /** @var \DCarbone\PHPFHIR\Version\DefaultConfig */ + private DefaultConfig $_defaultConfig; /** @var string */ private string $_name; @@ -106,7 +107,7 @@ public function __construct(Config $config, string $name, array $params = []) } if (!isset($this->_defaultConfig)) { - $this->_defaultConfig = new VersionDefaultConfig([]); + $this->_defaultConfig = new DefaultConfig([]); } $this->_sourceMetadata = new SourceMetadata($config, $this); @@ -200,21 +201,21 @@ public function setNamespace(string $namespace): self } /** - * @return \DCarbone\PHPFHIR\Version\VersionDefaultConfig + * @return \DCarbone\PHPFHIR\Version\DefaultConfig */ - public function getDefaultConfig(): VersionDefaultConfig + public function getDefaultConfig(): DefaultConfig { return $this->_defaultConfig; } /** - * @param array|\DCarbone\PHPFHIR\Version\VersionDefaultConfig $defaultConfig + * @param array|\DCarbone\PHPFHIR\Version\DefaultConfig $defaultConfig * @return $this */ - public function setDefaultConfig(array|VersionDefaultConfig $defaultConfig): self + public function setDefaultConfig(array|DefaultConfig $defaultConfig): self { if (is_array($defaultConfig)) { - $defaultConfig = new VersionDefaultConfig($defaultConfig); + $defaultConfig = new DefaultConfig($defaultConfig); } $this->_defaultConfig = $defaultConfig; return $this; diff --git a/src/Version/VersionDefaultConfig.php b/src/Version/DefaultConfig.php similarity index 94% rename from src/Version/VersionDefaultConfig.php rename to src/Version/DefaultConfig.php index 7a28abbd..cd588511 100644 --- a/src/Version/VersionDefaultConfig.php +++ b/src/Version/DefaultConfig.php @@ -18,11 +18,7 @@ * limitations under the License. */ -/** - * Class VersoinConfig - * @package DCarbone\PHPFHIR\Version - */ -class VersionDefaultConfig +class DefaultConfig { private const _UNSERIALIZE_CONFIG_KEYS = [ 'libxmlOpts', @@ -45,7 +41,7 @@ class VersionDefaultConfig */ public function __construct(array $config) { - foreach (VersionDefaultConfigKeyEnum::cases() as $k) { + foreach (DefaultConfigKeyEnum::cases() as $k) { if (isset($config[$k->value]) || array_key_exists($k->value, $config)) { $this->{"set{$k->value}"}($config[$k->value]); } diff --git a/src/Version/VersionDefaultConfigKeyEnum.php b/src/Version/DefaultConfigKeyEnum.php similarity index 95% rename from src/Version/VersionDefaultConfigKeyEnum.php rename to src/Version/DefaultConfigKeyEnum.php index 6d0685af..3249ab16 100644 --- a/src/Version/VersionDefaultConfigKeyEnum.php +++ b/src/Version/DefaultConfigKeyEnum.php @@ -18,7 +18,7 @@ * limitations under the License. */ -enum VersionDefaultConfigKeyEnum: string +enum DefaultConfigKeyEnum: string { case UNSERIALIZE_CONFIG = 'unserializeConfig'; case SERIALIZE_CONFIG = 'serializeConfig'; diff --git a/src/Version/Definition.php b/src/Version/Definition.php index 347e2902..aa5167a6 100644 --- a/src/Version/Definition.php +++ b/src/Version/Definition.php @@ -83,7 +83,7 @@ public function buildDefinition(): void $this->types = TypeExtractor::parseTypes($this->config, $this->version); $log->info('Finding restriction base types'); - TypeDecorator::findRestrictionBaseTypes($this->config, $this->types); + TypeDecorator::findRestrictionBaseTypes($this->version, $this->types); $log->info('Finding parent types'); TypeDecorator::findParentTypes($this->config, $this->types); diff --git a/src/Version/Definition/TypeDecorator.php b/src/Version/Definition/TypeDecorator.php index e53b4733..9de6caaf 100644 --- a/src/Version/Definition/TypeDecorator.php +++ b/src/Version/Definition/TypeDecorator.php @@ -61,12 +61,12 @@ public static function findComponentOfTypes(Config $config, Types $types): void } /** - * @param \DCarbone\PHPFHIR\Config $config + * @param \DCarbone\PHPFHIR\Version $version * @param \DCarbone\PHPFHIR\Version\Definition\Types $types */ - public static function findRestrictionBaseTypes(Config $config, Types $types): void + public static function findRestrictionBaseTypes(Version $version, Types $types): void { - $logger = $config->getLogger(); + $logger = $version->getConfig()->getLogger(); foreach ($types->getIterator() as $type) { $fhirName = $type->getFHIRName(); @@ -83,7 +83,10 @@ public static function findRestrictionBaseTypes(Config $config, Types $types): v if (str_starts_with($rbName, 'xs:')) { $rbName = substr($rbName, 3); - if ('token' === $rbName || ctype_upper($rbName[0])) { + // Found only in the DSTU1 "ResourceNamesPlusBinary" type as a restriction base, "NMTOKEN" is a string + // without whitespace. I do not feel like fussing with special logic around this, so force it to be + // a string. + if ($version->getSourceMetadata()->isDSTU1() && ('token' === $rbName || ctype_upper($rbName[0]))) { $logger->warning( sprintf( 'Type "%s" has restriction base "%s", setting to string...', @@ -239,10 +242,9 @@ private static function setTypeKind(Config $config, Types $types, Type $type, Ty */ private static function determineParsedTypeKind(Config $config, Version $version, Types $types, Type $type): void { - $logger = $config->getLogger(); + $logger = $version->getConfig()->getLogger(); $fhirName = $type->getFHIRName(); - - $versionName = $version->getName(); + $sourceMeta = $version->getSourceMetadata(); // there are a few specialty types kinds that are set during the parsing process, most notably for // html value types and primitive value types @@ -258,14 +260,14 @@ private static function determineParsedTypeKind(Config $config, Version $version } // check if this type is a DSTU1-specific primitive - if (in_array($fhirName, self::DSTU1_PRIMITIVES, true)) { + if ($sourceMeta->isDSTU1() && in_array($fhirName, self::DSTU1_PRIMITIVES, true)) { $logger->debug(sprintf('Setting Type "%s" kind to "%s"', $type->getFHIRName(), TypeKindEnum::PRIMITIVE->value)); $type->setKind(TypeKindEnum::PRIMITIVE); return; } // check if type is primitive... - if (str_contains($fhirName, PHPFHIR_PRIMITIVE_SUFFIX)) { + if (str_ends_with($fhirName, PHPFHIR_PRIMITIVE_SUFFIX)) { $logger->debug(sprintf('Type "%s" has primitive suffix, setting kind to "%s"', $type->getFHIRName(), TypeKindEnum::PRIMITIVE->value)); self::setTypeKind($config, $types, $type, TypeKindEnum::PRIMITIVE); return; @@ -281,7 +283,7 @@ private static function determineParsedTypeKind(Config $config, Version $version $rootType = $type->getRootType(); // if this is the "container" type for this FHIR version - if (TypeKindEnum::isContainerTypeName($fhirName)) { + if (TypeKindEnum::isContainerTypeName($version, $fhirName)) { $logger->debug(sprintf('Type "%s" is a container type, setting kind to "%s"', $type->getFHIRName(), $fhirName)); self::setTypeKind($config, $types, $type, $fhirName); return; @@ -296,7 +298,7 @@ private static function determineParsedTypeKind(Config $config, Version $version } // check if type is list... - if (str_contains($fhirName, PHPFHIR_LIST_SUFFIX)) { + if (str_ends_with($fhirName, PHPFHIR_LIST_SUFFIX)) { // for all intents and purposes, a List type is a multiple choice primitive type $logger->debug(sprintf('Type "%s" has list suffix, setting kind to "%s"', $type->getFHIRName(), TypeKindEnum::LIST->value)); self::setTypeKind($config, $types, $type, TypeKindEnum::LIST); @@ -306,7 +308,7 @@ private static function determineParsedTypeKind(Config $config, Version $version // This block indicates the type is only present as the child of a Resource. Its name may (and in many // cases does) conflict with a top level Element or Resource. Because of this, they are treated differently // and must be marked as such. - if (str_contains($fhirName, '.') && TypeKindEnum::RESOURCE_INLINE->value !== $fhirName) { + if (str_contains($fhirName, '.') && !$sourceMeta->isDSTU1() && TypeKindEnum::RESOURCE_INLINE->value !== $fhirName) { $logger->debug(sprintf('Type "%s" is not "%s" but has dot in name, setting kind to "%s"', $type->getFHIRName(), TypeKindEnum::RESOURCE_INLINE->value, TypeKindEnum::RESOURCE_COMPONENT->value)); self::setTypeKind($config, $types, $type, TypeKindEnum::RESOURCE_COMPONENT); return; diff --git a/src/Version/Definition/Types.php b/src/Version/Definition/Types.php index 3f67591b..e1bf023b 100644 --- a/src/Version/Definition/Types.php +++ b/src/Version/Definition/Types.php @@ -199,13 +199,14 @@ function (Type $t1, Type $t2) { * * Should be either "Resource.Inline" or "ResourceContainer" types. * + * @param \DCarbone\PHPFHIR\Version $version * @return \DCarbone\PHPFHIR\Version\Definition\Type|null */ - public function getContainerType(): null|Type + public function getContainerType(Version $version): null|Type { if (!isset($this->containerType)) { foreach ($this->types as $type) { - if ($type->getKind()->isContainer()) { + if ($type->getKind()->isContainer($version)) { $this->containerType = $type; break; } @@ -221,10 +222,10 @@ public function getContainerType(): null|Type public function isContainedType(Type $type): bool { // only bother with actual Resource types. - if ($type->getKind()->isContainer()) { + if ($type->getKind()->isContainer($type->getVersion())) { return false; } - $container = $this->getContainerType(); + $container = $this->getContainerType($type->getVersion()); if (null === $container) { return false; } diff --git a/src/Version/SourceMetadata.php b/src/Version/SourceMetadata.php index 9a90954a..69684b12 100644 --- a/src/Version/SourceMetadata.php +++ b/src/Version/SourceMetadata.php @@ -18,11 +18,14 @@ * limitations under the License. */ +use Composer\Semver\Semver; use DCarbone\PHPFHIR\Config; use DCarbone\PHPFHIR\Version; class SourceMetadata { + private const _DSTU1_VERSION_MAX = "0.0.82"; + /** @var \DCarbone\PHPFHIR\Config */ private Config $_config; /** @var \DCarbone\PHPFHIR\Version */ @@ -164,9 +167,19 @@ public function getFHIRGenerationDate(): string * @param bool $trimmed * @return string */ - public function getFHIRVersion(bool $trimmed): string + public function getFHIRVersionString(bool $trimmed): string { $this->compile(); return $trimmed ? trim($this->_fhirVersion, 'v') : $this->_fhirVersion; } + + /** + * Returns true if the upstream source was generated from, or is based on, DSTU1. + * + * @return bool + */ + public function isDSTU1(): bool + { + return Semver::satisfies($this->getFHIRVersionString(false), '<= ' . self::_DSTU1_VERSION_MAX); + } } \ No newline at end of file diff --git a/template/versions/core/classes/class_version.php b/template/versions/core/classes/class_version.php index dc0ab613..94d7c5fd 100644 --- a/template/versions/core/classes/class_version.php +++ b/template/versions/core/classes/class_version.php @@ -38,7 +38,7 @@ class implements getName(); ?>'; public const SOURCE_URL = 'getSourceUrl(); ?>'; - public const SOURCE_VERSION = 'getSourceMetadata()->getFHIRVersion(false); ?>'; + public const SOURCE_VERSION = 'getSourceMetadata()->getFHIRVersionString(false); ?>'; public const SOURCE_GENERATION_DATE = 'getSourceMetadata()->getFHIRGenerationDate(); ?>'; private const _GENERATED_CONFIG = getDefaultConfig()->toArray(), 1); ?>; diff --git a/template/versions/core/classes/class_version_type_map.php b/template/versions/core/classes/class_version_type_map.php index b78025ba..1499afc4 100644 --- a/template/versions/core/classes/class_version_type_map.php +++ b/template/versions/core/classes/class_version_type_map.php @@ -23,7 +23,7 @@ $config = $version->getConfig(); -$containerType = $types->getContainerType($version->getName()); +$containerType = $types->getContainerType($version); if (null === $containerType) { throw new \RuntimeException(sprintf( 'Unable to locate either "%s" or "%s" type', diff --git a/template/versions/core/interfaces/interface_version_contained_type.php b/template/versions/core/interfaces/interface_version_contained_type.php index 2a4d327f..bd4e0226 100644 --- a/template/versions/core/interfaces/interface_version_contained_type.php +++ b/template/versions/core/interfaces/interface_version_contained_type.php @@ -24,7 +24,7 @@ $config = $version->getConfig(); $namespace = $version->getFullyQualifiedName(false); -$containerType = $types->getContainerType(); +$containerType = $types->getContainerType($version); if (null === $containerType) { throw new \RuntimeException(sprintf( 'Unable to locate either "%s" or "%s" type', diff --git a/template/versions/types/properties/methods/default.php b/template/versions/types/properties/methods/default.php index 163da0ff..7c92be89 100644 --- a/template/versions/types/properties/methods/default.php +++ b/template/versions/types/properties/methods/default.php @@ -116,7 +116,7 @@ public function set(array $isContainer()) : ?> + elseif ($propertyTypeKind->isContainer($version)) : ?> /** diff --git a/template/versions/types/serialization/xml/serialize/body.php b/template/versions/types/serialization/xml/serialize/body.php index dc7ac65c..9d62cb65 100644 --- a/template/versions/types/serialization/xml/serialize/body.php +++ b/template/versions/types/serialization/xml/serialize/body.php @@ -81,7 +81,7 @@ if (null !== $pt) : $ptk = $pt->getKind(); // ... and IS a container - if ($ptk->isContainer()) : + if ($ptk->isContainer($version)) : if ($property->isCollection()) : ?> foreach($this->getGetterName(); ?>() as $v) { $xw->startElement(self::getFieldConstantName(); ?>); diff --git a/template/versions/types/tests/integration/class.php b/template/versions/types/tests/integration/class.php index 60f27475..eedec7c3 100644 --- a/template/versions/types/tests/integration/class.php +++ b/template/versions/types/tests/integration/class.php @@ -149,7 +149,7 @@ protected function fetchResourceBundle(string $format): string $dlDir = trim((string)getenv('')); if ('' !== $dlDir) { $this->assertDirectoryExists($dlDir, sprintf('Configured test resource download directory "%s" does not exist.', $dlDir)); - $fname = sprintf('%s%sgetFHIRName(); ?>-getSourceMetadata()->getFHIRVersion(false); ?>-source.%s', $dlDir, DIRECTORY_SEPARATOR, $format); + $fname = sprintf('%s%sgetFHIRName(); ?>-getSourceMetadata()->getFHIRVersionString(false); ?>-source.%s', $dlDir, DIRECTORY_SEPARATOR, $format); file_put_contents($fname, $rc->resp); $this->assertFileExists($fname, sprintf('Failed to write fetched resource bundle to "%s"', $fname)); } diff --git a/template/versions/types/tests/validation/class.php b/template/versions/types/tests/validation/class.php index e95668d7..a7c07931 100644 --- a/template/versions/types/tests/validation/class.php +++ b/template/versions/types/tests/validation/class.php @@ -138,7 +138,7 @@ protected function _runFHIRValidationJAR(string $filename): array $output = []; $code = -1; $cmd = sprintf( - 'java -jar %s %s -version getSourceMetadata()->getFHIRVersion(true); ?>', + 'java -jar %s %s -version getSourceMetadata()->getFHIRVersionString(true); ?>', PHPFHIR_FHIR_VALIDATION_JAR, $filename ); @@ -180,7 +180,7 @@ protected function fetchResourceBundle(string $format): string } $this->assertIsString($rc->resp); $this->_fetchedResources[$format] = $rc->resp; - // $fname = sprintf('%s%sgetFHIRName(); ?>-getSourceMetadata()->getFHIRVersion(false); ?>-source.%s', PHPFHIR_OUTPUT_TMP_DIR, DIRECTORY_SEPARATOR, $format); + // $fname = sprintf('%s%sgetFHIRName(); ?>-getSourceMetadata()->getFHIRVersionString(false); ?>-source.%s', PHPFHIR_OUTPUT_TMP_DIR, DIRECTORY_SEPARATOR, $format); // file_put_contents($fname, $rc->resp); return $rc->resp; } @@ -237,7 +237,7 @@ public function testFHIRValidationXML(): void $resource = $entry->getResource(); - $fname = PHPFHIR_OUTPUT_TMP_DIR . DIRECTORY_SEPARATOR . $resource->_getFHIRTypeName() . '-getSourceMetadata()->getFHIRVersion(false); ?>.xml'; + $fname = PHPFHIR_OUTPUT_TMP_DIR . DIRECTORY_SEPARATOR . $resource->_getFHIRTypeName() . '-getSourceMetadata()->getFHIRVersionString(false); ?>.xml'; file_put_contents($fname, $bundle->xmlSerialize()->ownerDocument->saveXML()); $this->assertFileExists($fname); @@ -295,7 +295,7 @@ public function testFHIRValidationJSON() $resource = $entry->getResource(); - $fname = PHPFHIR_OUTPUT_TMP_DIR . DIRECTORY_SEPARATOR . $resource->_getFHIRTypeName() . '-getSourceMetadata()->getFHIRVersion(false); ?>.json'; + $fname = PHPFHIR_OUTPUT_TMP_DIR . DIRECTORY_SEPARATOR . $resource->_getFHIRTypeName() . '-getSourceMetadata()->getFHIRVersionString(false); ?>.json'; file_put_contents($fname, json_encode($bundle)); $this->assertFileExists($fname);