src/Money/Money.php
/**
     * @param CurrencyPair $currencyPair
     * @return Money
     * @throw \InvalidArgumentException
     */
@param CurrencyPair $currencyPair
@return Money
@throw \InvalidArgumentException
@param CurrencyPair $currencyPair @return Money @throw \ InvalidArgumentException
public function exchange(CurrencyPair $currencyPair)
    {
        if (!$this->isSameCurrencyInCurrencyPair($currencyPair)) {
            throw new \InvalidArgumentException('CurrencyFrom in the CurrencyPair does not match the money currency');
        }
        return new Money($currencyPair->currencyTo(), (int)($this->value() * $currencyPair->ratio()));
    }
public function exchange ( CurrencyPair $ currencyPair ) { if ( ! $ this -> isSameCurrencyInCurrencyPair ( $ currencyPair ) ) { throw new \ InvalidArgumentException ( 'CurrencyFrom in the CurrencyPair does not match the money currency' ) ; } return new Money ( $ currencyPair -> currencyTo ( ) , ( int ) ( $ this -> value ( ) * $ currencyPair -> ratio ( ) ) ) ; }
@param CurrencyPair $currencyPair
 @return Money
 @throw \InvalidArgumentException
@param CurrencyPair $currencyPair @return Money @throw \ InvalidArgumentException