Skip to content

Commit b934b89

Browse files
committed
more template cleanup
1 parent 86ab3bc commit b934b89

File tree

5 files changed

+13
-130
lines changed

5 files changed

+13
-130
lines changed

template/versions/types/methods/constructors/resource_container_property_setter_call.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
$typeClass = new $typeClassName($d);
5656
} else if (!is_object($data[self::<?php echo $propertyFieldConst; ?>]) || !($data[self::<?php echo $propertyFieldConst; ?>] instanceof <?php echo PHPFHIR_INTERFACE_VERSION_CONTAINED_TYPE; ?>)) {
5757
throw new \InvalidArgumentException(sprintf(
58-
'<?php echo $typeClassName; ?> - Field "<?php echo $propertyName; ?>" must be an object implementing <?php echo $version->getFullyQualifiedName(true, PHPFHIR_INTERFACE_VERSION_CONTAINED_TYPE); ?>, object of type %s seen',
58+
'<?php echo $typeClassName; ?> - Field "<?php echo $propertyName; ?>" must be an array or object implementing <?php echo $version->getFullyQualifiedName(true, PHPFHIR_INTERFACE_VERSION_CONTAINED_TYPE); ?>, %s seen',
5959
is_object($data[self::<?php echo $propertyFieldConst; ?>]) ? get_class($data[self::<?php echo $propertyFieldConst; ?>]) : gettype($data[self::<?php echo $propertyFieldConst; ?>])
6060
));
6161
} else {

template/versions/types/serialization/json.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,6 @@
3333
'type' => $type,
3434
]
3535
);
36-
elseif ($typeKind->isResourceContainer($version)) :
37-
echo require_with(
38-
PHPFHIR_TEMPLATE_VERSION_TYPES_SERIALIZATION_DIR . DIRECTORY_SEPARATOR . 'json' . DIRECTORY_SEPARATOR . 'resource_container.php',
39-
[
40-
'version' => $version,
41-
'type' => $type,
42-
]
43-
);
4436
else:
4537
echo require_with(
4638
PHPFHIR_TEMPLATE_VERSION_TYPES_SERIALIZATION_DIR . DIRECTORY_SEPARATOR . 'json' . DIRECTORY_SEPARATOR . 'default.php',

template/versions/types/serialization/json/resource_container.php

Lines changed: 0 additions & 35 deletions
This file was deleted.

template/versions/types/serialization/xml.php

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -49,35 +49,24 @@
4949

5050
<?php
5151
// serialize portion
52-
// ResourceContainer and Resource.Inline types have their own special xml serialization mechanism
53-
if ($typeKind->isOneOf(TypeKindEnum::RESOURCE_CONTAINER, TypeKindEnum::RESOURCE_INLINE)) {
54-
echo require_with(
55-
PHPFHIR_TEMPLATE_VERSION_TYPES_SERIALIZATION_DIR . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR . 'serialize' . DIRECTORY_SEPARATOR . 'resource_container.php',
56-
[
57-
'version' => $version,
58-
'type' => $type,
59-
]
60-
);
61-
} else {
62-
// everything else shares a common header
52+
echo require_with(
53+
PHPFHIR_TEMPLATE_VERSION_TYPES_SERIALIZATION_DIR . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR . 'serialize' . DIRECTORY_SEPARATOR . 'header.php',
54+
[
55+
'version' => $version,
56+
'type' => $type,
57+
]
58+
);
59+
60+
if ($type->hasLocalProperties()) {
6361
echo require_with(
64-
PHPFHIR_TEMPLATE_VERSION_TYPES_SERIALIZATION_DIR . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR . 'serialize' . DIRECTORY_SEPARATOR . 'header.php',
62+
PHPFHIR_TEMPLATE_VERSION_TYPES_SERIALIZATION_DIR . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR . 'serialize' . DIRECTORY_SEPARATOR . 'body.php',
6563
[
6664
'version' => $version,
6765
'type' => $type,
6866
]
6967
);
70-
71-
if ($type->hasLocalProperties()) {
72-
echo require_with(
73-
PHPFHIR_TEMPLATE_VERSION_TYPES_SERIALIZATION_DIR . DIRECTORY_SEPARATOR . 'xml' . DIRECTORY_SEPARATOR . 'serialize' . DIRECTORY_SEPARATOR . 'body.php',
74-
[
75-
'version' => $version,
76-
'type' => $type,
77-
]
78-
);
79-
}
80-
} ?>
68+
}
69+
?>
8170
if (isset($rootOpened) && $rootOpened) {
8271
$xw->endElement();
8372
}

template/versions/types/serialization/xml/serialize/resource_container.php

Lines changed: 0 additions & 63 deletions
This file was deleted.

0 commit comments

Comments
 (0)