private function convertCurrency(
        CurrencyInterface $currencyFrom,
        CurrencyInterface $currencyTo,
        $amount
    ) {
        if ($currencyFrom->getIso() == $currencyTo->getIso()) {
            return Money::create($amount, $currencyFrom);
        }

        $exchangeRate = $this
            ->exchangeRateCalculator
            ->calculateExchangeRate(
                $currencyFrom,
                $currencyTo
            );

        return Money::create(
            $amount * $exchangeRate,
            $currencyTo
        );
    }
private function convertCurrency(
        CurrencyInterface $currencyFrom,
        CurrencyInterface $currencyTo,
        $amount
    ) {
        if ($currencyFrom->getIso() == $currencyTo->getIso()) {
            return Money::create($amount, $currencyFrom);
        }

        $exchangeRate = $this
            ->exchangeRateCalculator
            ->calculateExchangeRate(
                $currencyFrom,
                $currencyTo
            );

        return Money::create(
            $amount * $exchangeRate,
            $currencyTo
        );
    }
private function convertCurrency ( CurrencyInterface $ currencyFrom , CurrencyInterface $ currencyTo , $ amount ) { if ( $ currencyFrom -> getIso ( ) == $ currencyTo -> getIso ( ) ) { return Money :: create ( $ amount , $ currencyFrom ) ; } $ exchangeRate = $ this -> exchangeRateCalculator -> calculateExchangeRate ( $ currencyFrom , $ currencyTo ) ; return Money :: create ( $ amount * $ exchangeRate , $ currencyTo ) ; }
Convert amount between two currencies.

If are the same currency, return same amount

If is impossible to convert between them, throw Exception

@param CurrencyInterface $currencyFrom Currency where to convert from
@param CurrencyInterface $currencyTo   Currency where to convert to
@param int               $amount       Amount to convert

@return MoneyInterface Money converted

@throws CurrencyNotConvertibleException Currencies cannot be converted
Convert amount between two currencies .