Skip to content

Commit 055c135

Browse files
HP-2419 extended functional of BillingRegistry for easier use
1 parent a9e3868 commit 055c135

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/product/price/PriceTypeDefinition.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace hiqdev\php\billing\product\price;
44

5+
use hiqdev\billing\registry\Type\TypeSemantics;
56
use hiqdev\php\billing\product\AggregateInterface;
67
use hiqdev\php\billing\product\Exception\AggregateNotDefinedException;
78
use hiqdev\php\billing\product\behavior\BehaviorPriceTypeDefinitionCollection;
@@ -209,4 +210,11 @@ public function belongsToTariffType(string $tariffTypeName): bool
209210
{
210211
return $this->getTariffTypeDefinition()->tariffType()->equalsName($tariffTypeName);
211212
}
213+
214+
public function belongsToPriceType(PriceTypeInterface $priceType): bool
215+
{
216+
$typeSemantics = new TypeSemantics();
217+
218+
return $typeSemantics->belongsToLocalCategory($this->type(), $priceType->name());
219+
}
212220
}

src/product/price/PriceTypeDefinitionInterface.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,8 @@ public function getAggregate(): AggregateInterface;
5454
* @return TariffTypeDefinitionInterface
5555
*/
5656
public function getTariffTypeDefinition(): TariffTypeDefinitionInterface;
57+
58+
public function belongsToTariffType(string $tariffTypeName): bool;
59+
60+
public function belongsToPriceType(PriceTypeInterface $priceType): bool;
5761
}

0 commit comments

Comments
 (0)