/** * Get exchanged amount * * @param int $amount * @param string $originalCurrency * @param string $destinationCurrency */ public function exchange($amount, $originalCurrency, $destinationCurrency = null) { if (null !== $destinationCurrency) { if ($originalCurrency == $destinationCurrency) { return $amount; } } $amount = new Decimal($amount); if ($originalCurrency == CurrencyCode::PLN) { return $amount->mul($this->ratio)->getAmount(); } else { return $amount->getAmount() / $this->ratio; } }
public function removeFrozen($amount) { if (!$amount instanceof Decimal) { $amount = new Decimal($amount); } $this->frozen = Decimal::create($this->frozen)->sub($amount)->getAmount(); }