Skip to content

Commit 1acbb7b

Browse files
HP-1751 Removed dependency php-billing package from PriceTypeDefinitionBehaviourCollection and TariffTypeBehaviorCollection classes
1 parent 881679f commit 1acbb7b

13 files changed

+72
-19
lines changed

src/product/BillingRegistry.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
use hiqdev\billing\registry\product\Aggregate;
77
use hiqdev\billing\registry\quantity\formatter\QuantityFormatterNotFoundException;
88
use hiqdev\billing\registry\quantity\FractionQuantityData;
9+
use hiqdev\php\billing\product\behavior\BehaviorInterface;
10+
use hiqdev\php\billing\product\behavior\BehaviorNotFoundException;
911
use hiqdev\php\billing\type\Type;
1012
use hiqdev\php\billing\type\TypeInterface;
1113

src/product/Domain/Model/TariffTypeInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
interface TariffTypeInterface
66
{
77

8-
}
8+
}

src/product/Domain/Model/Unit/FractionUnitInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
interface FractionUnitInterface
66
{
77

8-
}
8+
}

src/product/Domain/Model/Unit/UnitInterface.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
interface UnitInterface
88
{
99
public function createExternalUnit(): BaseUnitInterface;
10+
1011
public function fractionUnit(): FractionUnitInterface;
11-
}
12+
}

src/product/ParentNodeDefinitionInterface.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22

33
namespace hiqdev\php\billing\product;
44

5+
use hiqdev\php\billing\product\behavior\BehaviorCollectionInterface;
6+
57
interface ParentNodeDefinitionInterface
68
{
7-
public function withBehaviors(): BehaviorCollection;
9+
public function withBehaviors(): BehaviorCollectionInterface;
810

911
public function hasBehavior(string $behaviorClassName): bool;
1012
}

src/product/PriceTypeDefinition.php

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

33
namespace hiqdev\php\billing\product;
44

5-
use hiqdev\billing\registry\behavior\PriceTypeDefinitionBehaviourCollection;
5+
use hiqdev\php\billing\product\behavior\BehaviourPriceTypeDefinitionCollection;
66
use hiqdev\billing\registry\invoice\InvoiceRepresentationCollection;
77
use hiqdev\billing\registry\product\Aggregate;
88
use hiqdev\billing\registry\quantity\formatter\QuantityFormatterDefinition;
@@ -24,7 +24,7 @@ class PriceTypeDefinition implements ParentNodeDefinitionInterface
2424

2525
private InvoiceRepresentationCollection $invoiceCollection;
2626

27-
private PriceTypeDefinitionBehaviourCollection $behaviorCollection;
27+
private BehaviourPriceTypeDefinitionCollection $behaviorCollection;
2828

2929
private Aggregate $aggregate;
3030

@@ -34,7 +34,7 @@ public function __construct(
3434
TariffTypeInterface $tariffType,
3535
) {
3636
$this->invoiceCollection = new InvoiceRepresentationCollection($this);
37-
$this->behaviorCollection = new PriceTypeDefinitionBehaviourCollection($this, $tariffType);
37+
$this->behaviorCollection = new BehaviourPriceTypeDefinitionCollection($this, $tariffType);
3838

3939
$this->init();
4040
}
@@ -117,7 +117,7 @@ public function getUnit(): UnitInterface
117117
return $this->unit;
118118
}
119119

120-
public function withBehaviors(): PriceTypeDefinitionBehaviourCollection
120+
public function withBehaviors(): BehaviourPriceTypeDefinitionCollection
121121
{
122122
return $this->behaviorCollection;
123123
}

src/product/TariffTypeDefinition.php

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

33
namespace hiqdev\php\billing\product;
44

5-
use hiqdev\billing\registry\behavior\TariffTypeBehaviorCollection;
5+
use hiqdev\php\billing\product\behavior\BehaviorTariffTypeCollection;
66
use hiqdev\billing\registry\product\Product;
77
use hiqdev\php\billing\product\Domain\Model\TariffTypeInterface;
88

@@ -12,12 +12,12 @@ class TariffTypeDefinition implements ParentNodeDefinitionInterface
1212

1313
private PriceTypeDefinitionCollection $prices;
1414

15-
private TariffTypeBehaviorCollection $behaviorCollection;
15+
private BehaviorTariffTypeCollection $behaviorCollection;
1616

1717
public function __construct(private readonly TariffTypeInterface $tariffType)
1818
{
1919
$this->prices = new PriceTypeDefinitionCollection($this);
20-
$this->behaviorCollection = new TariffTypeBehaviorCollection($this, $tariffType);
20+
$this->behaviorCollection = new BehaviorTariffTypeCollection($this, $tariffType);
2121
}
2222

2323
public function tariffType(): TariffTypeInterface
@@ -43,7 +43,7 @@ public function withPrices(): PriceTypeDefinitionCollection
4343
return $this->prices;
4444
}
4545

46-
public function withBehaviors(): TariffTypeBehaviorCollection
46+
public function withBehaviors(): BehaviorTariffTypeCollection
4747
{
4848
return $this->behaviorCollection;
4949
}

src/product/BehaviorCollection.php renamed to src/product/behavior/BehaviorCollection.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?php declare(strict_types=1);
22

3-
namespace hiqdev\php\billing\product;
3+
namespace hiqdev\php\billing\product\behavior;
44

55
use hiqdev\php\billing\product\Domain\Model\TariffTypeInterface;
66

7-
class BehaviorCollection implements \IteratorAggregate
7+
class BehaviorCollection implements BehaviorCollectionInterface
88
{
99
/** @var BehaviorInterface[] */
1010
private array $behaviors = [];
@@ -13,9 +13,6 @@ public function __construct(private readonly TariffTypeInterface $tariffType)
1313
{
1414
}
1515

16-
/**
17-
* @return BehaviorInterface[]
18-
*/
1916
public function getIterator(): \Traversable
2017
{
2118
return new \ArrayIterator($this->behaviors);
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace hiqdev\php\billing\product\behavior;
4+
5+
interface BehaviorCollectionInterface extends \IteratorAggregate
6+
{
7+
/**
8+
* @return BehaviorInterface[]
9+
*/
10+
public function getIterator(): \Traversable;
11+
12+
public function attach(BehaviorInterface $behavior): self;
13+
}

src/product/BehaviorInterface.php renamed to src/product/behavior/BehaviorInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php declare(strict_types=1);
22

3-
namespace hiqdev\php\billing\product;
3+
namespace hiqdev\php\billing\product\behavior;
44

55
use hiqdev\php\billing\product\Domain\Model\TariffTypeInterface;
66

0 commit comments

Comments
 (0)