Skip to content

Commit 03ee8dc

Browse files
HP-1751 tiny
1 parent 7269bf9 commit 03ee8dc

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/product/BillingRegistry.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ public function getRepresentationsByType(string $representationClass): array
5353
throw new InvalidRepresentationException("Class '$representationClass' does not exist");
5454
}
5555

56+
if (!is_subclass_of($representationClass, RepresentationInterface::class)) {
57+
throw new InvalidBehaviorException(
58+
sprintf('Representation class "%s" does not implement RepresentationInterface', $representationClass)
59+
);
60+
}
61+
5662
$representations = [];
5763
foreach ($this->priceTypes() as $priceTypeDefinition) {
5864
foreach ($priceTypeDefinition->documentRepresentation() as $representation) {
@@ -100,6 +106,12 @@ public function getBehavior(string $type, string $behaviorClassWrapper): Behavio
100106
);
101107
}
102108

109+
if (!is_subclass_of($behaviorClassWrapper, BehaviorInterface::class)) {
110+
throw new InvalidBehaviorException(
111+
sprintf('Behavior class "%s" does not implement BehaviorInterface', $behaviorClassWrapper)
112+
);
113+
}
114+
103115
$billingType = $this->convertStringTypeToType($type);
104116

105117
foreach ($this->priceTypes() as $priceTypeDefinition) {

0 commit comments

Comments
 (0)