Skip to content

Commit 12f688d

Browse files
HP-1751 tiny
1 parent 00f6b67 commit 12f688d

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

src/product/BillingRegistry.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@
1919
class BillingRegistry implements BillingRegistryInterface
2020
{
2121
/** @var TariffTypeDefinitionInterface[] */
22-
private array $tariffTypes = [];
22+
private array $tariffTypeDefinitions = [];
2323
private bool $locked = false;
2424

25-
public function addTariffType(TariffTypeDefinitionInterface $tariffType): void
25+
public function addTariffType(TariffTypeDefinitionInterface $tariffTypeDefinition): void
2626
{
2727
if ($this->locked) {
2828
throw new BillingRegistryLockedException("BillingRegistry is locked and cannot be modified.");
2929
}
3030

31-
$this->tariffTypes[] = $tariffType;
31+
$this->tariffTypeDefinitions[] = $tariffTypeDefinition;
3232
}
3333

3434
public function lock(): void
@@ -38,8 +38,8 @@ public function lock(): void
3838

3939
public function priceTypes(): \Generator
4040
{
41-
foreach ($this->tariffTypes as $tariffType) {
42-
foreach ($tariffType->withPrices() as $priceTypeDefinition) {
41+
foreach ($this->tariffTypeDefinitions as $tariffTypeDefinition) {
42+
foreach ($tariffTypeDefinition->withPrices() as $priceTypeDefinition) {
4343
yield $priceTypeDefinition;
4444
}
4545
}
@@ -146,7 +146,7 @@ private function findBehaviorInPriceType(
146146

147147
public function getBehaviors(string $behaviorClassWrapper): \Generator
148148
{
149-
foreach ($this->tariffTypes as $tariffType) {
149+
foreach ($this->tariffTypeDefinitions as $tariffType) {
150150
foreach ($tariffType->withBehaviors() as $behavior) {
151151
if ($behavior instanceof $behaviorClassWrapper) {
152152
yield $behavior;

tests/unit/product/BillingRegistryTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,9 @@ public function testGetBehavior(): void
6767
$tariffType = new DummyTariffType();
6868
$tariffTypeDefinition = new TariffTypeDefinition($tariffType);
6969
$dummyBehavior = new DummyBehavior('dummy');
70-
$tariffTypeDefinition->withBehaviors()
71-
->attach($dummyBehavior);
70+
$tariffTypeDefinition->withBehaviors()->attach($dummyBehavior);
71+
$this->registry->addTariffType($tariffTypeDefinition); // monthly()
7272

73-
$this->registry->addTariffType($tariffTypeDefinition);
7473
$behavior = $this->registry->getBehavior($tariffType->name(), DummyBehavior::class);
7574

7675
$this->assertSame($dummyBehavior->getContext(), $behavior->getContext());

0 commit comments

Comments
 (0)