/** * @param string $key * @param float $exchangeRate * * @return RateCollection */ public function add($key, $exchangeRate) { $rate = new Rate(); $rate->setKey($key)->setExchangeRate($exchangeRate); if (!$this->has($key)) { $this->put($key, $rate); } return $this; }
/** * @test */ public function testCanSetKeyAndGetCurrencies() { $this->rate->setKey('USD_EUR'); $this->assertEquals('USD', $this->rate->getFromIso()); $this->assertEquals('EUR', $this->rate->getToIso()); }