Exemple #1
0
 /**
  * @inheritdoc
  */
 public function getCost(CurrencyInterface $currency)
 {
     /** @var MoneyInterface $result */
     $result = Money::zero($currency);
     foreach ($this->items as $item) {
         $result = $result->add($item->getCost());
     }
     return $result;
 }
Exemple #2
0
 /**
  * @inheritdoc
  */
 public function getCartCost(CartInterface $cart, CurrencyInterface $currency)
 {
     $result = Money::zero($currency);
     $items = $cart->getCartItems();
     foreach ($items as $item) {
         $result = $this->moneyManager->add($result, $this->moneyManager->mul($item->getCost(), $item->getQuantity()));
     }
     return $result;
 }