Skip to content

Commit dc3f53c

Browse files
committed
ACP2E-1634: addressing CR comments
1 parent fecee60 commit dc3f53c

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

app/code/Magento/Catalog/Pricing/Price/MinimalTierPriceCalculator.php

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ class MinimalTierPriceCalculator implements MinimalPriceCalculatorInterface
3131
public function __construct(CalculatorInterface $calculator)
3232
{
3333
$this->calculator = $calculator;
34-
$this->lowestTierPrice = null;
3534
}
3635

3736
/**
@@ -42,6 +41,20 @@ public function __construct(CalculatorInterface $calculator)
4241
*/
4342
public function getValue(SaleableInterface $saleableItem)
4443
{
44+
return $this->getAmount($saleableItem)?->getValue();
45+
}
46+
47+
/**
48+
* Return calculated amount object that keeps "as low as" value{@inheritdoc}
49+
*
50+
* @param SaleableInterface $saleableItem
51+
* @return AmountInterface|null
52+
*/
53+
public function getAmount(SaleableInterface $saleableItem)
54+
{
55+
$value = $this->getValue($saleableItem);
56+
return $value === null ? null : $this->lowestTierPrice;
57+
4558
$this->lowestTierPrice = null;
4659
/** @var TierPrice $price */
4760
$tierPrice = $saleableItem->getPriceInfo()->getPrice(TierPrice::PRICE_CODE);
@@ -58,18 +71,6 @@ public function getValue(SaleableInterface $saleableItem)
5871
}
5972
}
6073

61-
return $this->lowestTierPrice?->getValue();
62-
}
63-
64-
/**
65-
* Return calculated amount object that keeps "as low as" value{@inheritdoc}
66-
*
67-
* @param SaleableInterface $saleableItem
68-
* @return AmountInterface|null
69-
*/
70-
public function getAmount(SaleableInterface $saleableItem)
71-
{
72-
$value = $this->getValue($saleableItem);
73-
return $value === null ? null : $this->lowestTierPrice;
74+
return $this->lowestTierPrice;
7475
}
7576
}

0 commit comments

Comments
 (0)