Skip to content

Commit 9d367cd

Browse files
HP-1751 complete BillingRegistryInterface
1 parent 0d8bd65 commit 9d367cd

File tree

2 files changed

+43
-22
lines changed

2 files changed

+43
-22
lines changed

src/product/BillingRegistry.php

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use hiqdev\php\billing\product\invoice\InvalidRepresentationException;
88
use hiqdev\php\billing\product\invoice\RepresentationInterface;
99
use hiqdev\php\billing\product\price\PriceTypeDefinition;
10-
use hiqdev\php\billing\product\price\PriceTypeDefinitionInterface;
1110
use hiqdev\php\billing\product\quantity\QuantityFormatterInterface;
1211
use hiqdev\php\billing\product\quantity\QuantityFormatterNotFoundException;
1312
use hiqdev\php\billing\product\quantity\FractionQuantityData;
@@ -32,10 +31,6 @@ public function addTariffType(TariffTypeDefinitionInterface $tariffTypeDefinitio
3231
$this->tariffTypeDefinitions[] = $tariffTypeDefinition;
3332
}
3433

35-
/**
36-
* @return \Generator
37-
* @psalm-return \Generator<PriceTypeDefinitionInterface>
38-
*/
3934
public function priceTypes(): \Generator
4035
{
4136
foreach ($this->tariffTypeDefinitions as $tariffTypeDefinition) {
@@ -45,10 +40,6 @@ public function priceTypes(): \Generator
4540
}
4641
}
4742

48-
/**
49-
* @param string $representationClass
50-
* @return RepresentationInterface[]
51-
*/
5243
public function getRepresentationsByType(string $representationClass): array
5344
{
5445
if (!class_exists($representationClass)) {
@@ -93,13 +84,6 @@ private function convertStringTypeToType(string $type): TypeInterface
9384
return Type::anyId($type);
9485
}
9586

96-
/**
97-
* @param string $type - full type like 'overuse,lb_capacity_unit'
98-
* @param string $behaviorClassWrapper
99-
* @return BehaviorInterface
100-
* @throws BehaviorNotFoundException
101-
* @throws InvalidBehaviorException
102-
*/
10387
public function getBehavior(string $type, string $behaviorClassWrapper): BehaviorInterface
10488
{
10589
if (!class_exists($behaviorClassWrapper)) {
@@ -176,10 +160,6 @@ public function getAggregate(string $type): AggregateInterface
176160
throw new AggregateNotFoundException('Aggregate was not found');
177161
}
178162

179-
/**
180-
* @return \Generator
181-
* @psalm-return \Generator<TariffTypeDefinitionInterface>
182-
*/
183163
public function getTariffTypeDefinitions(): \Generator
184164
{
185165
foreach ($this->tariffTypeDefinitions as $tariffTypeDefinition) {

src/product/BillingRegistryInterface.php

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,54 @@
33
namespace hiqdev\php\billing\product;
44

55
use Generator;
6-
use hiqdev\php\billing\product\price\PriceTypeDefinition;
6+
use hiqdev\php\billing\product\behavior\BehaviorInterface;
7+
use hiqdev\php\billing\product\behavior\BehaviorNotFoundException;
8+
use hiqdev\php\billing\product\behavior\InvalidBehaviorException;
9+
use hiqdev\php\billing\product\invoice\RepresentationInterface;
10+
use hiqdev\php\billing\product\price\PriceTypeDefinitionInterface;
11+
use hiqdev\php\billing\product\quantity\FractionQuantityData;
12+
use hiqdev\php\billing\product\quantity\QuantityFormatterInterface;
713
use hiqdev\php\billing\product\trait\HasLockInterface;
814

915
interface BillingRegistryInterface extends HasLockInterface
1016
{
1117
/**
12-
* @return Generator<PriceTypeDefinition>
18+
* @return Generator
19+
* @psalm-return Generator<PriceTypeDefinitionInterface>
1320
*/
1421
public function priceTypes(): Generator;
22+
23+
public function addTariffType(TariffTypeDefinitionInterface $tariffTypeDefinition): void;
24+
25+
/**
26+
* @param string $representationClass
27+
* @return RepresentationInterface[]
28+
*/
29+
public function getRepresentationsByType(string $representationClass): array;
30+
31+
public function createQuantityFormatter(string $type, FractionQuantityData $data): QuantityFormatterInterface;
32+
33+
/**
34+
* @param string $type - full type like 'overuse,lb_capacity_unit'
35+
* @param string $behaviorClassWrapper
36+
* @return BehaviorInterface
37+
* @throws BehaviorNotFoundException
38+
* @throws InvalidBehaviorException
39+
*/
40+
public function getBehavior(string $type, string $behaviorClassWrapper): BehaviorInterface;
41+
42+
/**
43+
* @param string $behaviorClassWrapper
44+
* @return Generator
45+
* @psalm-return Generator<BehaviorInterface>
46+
*/
47+
public function getBehaviors(string $behaviorClassWrapper): Generator;
48+
49+
public function getAggregate(string $type): AggregateInterface;
50+
51+
/**
52+
* @return Generator
53+
* @psalm-return Generator<TariffTypeDefinitionInterface>
54+
*/
55+
public function getTariffTypeDefinitions(): Generator;
1556
}

0 commit comments

Comments
 (0)