@@ -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