Skip to content

Commit d0666f1

Browse files
HP-1751 created class for search ResourceDecoratorBehavior
1 parent e539a12 commit d0666f1

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
@@ -3,6 +3,7 @@
33
namespace hiqdev\php\billing\product;
44

55
use hiqdev\php\billing\product\behavior\InvalidBehaviorException;
6+
use hiqdev\php\billing\product\Domain\Model\TariffTypeInterface;
67
use hiqdev\php\billing\product\Exception\AggregateNotFoundException;
78
use hiqdev\php\billing\product\Exception\BillingRegistryLockedException;
89
use hiqdev\php\billing\product\invoice\InvalidRepresentationException;
@@ -180,4 +181,15 @@ public function getAggregate(string $type): AggregateInterface
180181

181182
throw new AggregateNotFoundException('Aggregate was not found');
182183
}
184+
185+
public function getTariffTypeDefinitionByTariffType(TariffTypeInterface $tariffType): TariffTypeDefinitionInterface
186+
{
187+
foreach ($this->tariffTypeDefinitions as $tariffTypeDefinition) {
188+
if ($tariffTypeDefinition->tariffType() === $tariffType) {
189+
return $tariffTypeDefinition;
190+
}
191+
}
192+
193+
throw new TariffTypeDefinitionNotFoundException('Tariff type definition was not found');
194+
}
183195
}

0 commit comments

Comments
 (0)