Skip to content

Commit ab1f2f5

Browse files
HP-1751 created BehaviorInterface
1 parent be007f7 commit ab1f2f5

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/product/BehaviorInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44

55
interface BehaviorInterface
66
{
7-
public function execute(): void;
7+
public function class(): string;
88
}

src/product/BillingRegistry.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,15 @@ public function getConsumptionGroups(): \Generator
8282
yield $tariffType->consumption()->groups();
8383
}
8484
}
85+
86+
public function behavior(string $behaviorClassWrapper): \Generator
87+
{
88+
foreach ($this->priceTypes() as $priceTypeDefinition) {
89+
foreach ($priceTypeDefinition->withBehaviors() as $behavior) {
90+
if ($behavior instanceof $behaviorClassWrapper) {
91+
yield $behavior;
92+
}
93+
}
94+
}
95+
}
8596
}

0 commit comments

Comments
 (0)