public function test__toString()
 {
     $btc = new Currency('BTC', 8, 8);
     $usd = new Currency('USD', 2, 2, '$');
     $btcToUsd = new ExchangeRate($btc, $usd, 130);
     $this->assertEquals('BTC:USD@130', $btcToUsd->__toString());
     $this->assertEquals('BTC:USD@130', (string) $btcToUsd);
 }
 public function __construct(CurrencyInterface $fromCurrency = null, CurrencyInterface $toCurrency = null, $rate = null, $type = null, MoneyInterface $depth = null)
 {
     if (is_null($fromCurrency) || is_null($toCurrency) || is_null($rate)) {
         return;
     }
     parent::__construct($fromCurrency, $toCurrency, $rate);
     if (is_null($type)) {
         return;
     }
     $this->setType($type);
     if (is_null($depth)) {
         return;
     }
     $this->setDepth($depth);
 }