public function convertBaseRateToCurrency(string $currency) : Rates
    {
        if (!empty($this->rates)) {
            if ($this->base !== $currency) {
                if (!empty($this->rates[$currency])) {
                    $usdrate = $this->rates[$currency];
                    foreach ($this->rates as $key => $rate) {
                        $newrates[$key] = $rate * (1 / $usdrate);
                    }
                }
            }
        }
        if (!empty($newrates)) {
            $this->rates = $newrates;
            $this->base = $currency;
        }

        return $this;
    }
public function convertBaseRateToCurrency(string $currency) : Rates
    {
        if (!empty($this->rates)) {
            if ($this->base !== $currency) {
                if (!empty($this->rates[$currency])) {
                    $usdrate = $this->rates[$currency];
                    foreach ($this->rates as $key => $rate) {
                        $newrates[$key] = $rate * (1 / $usdrate);
                    }
                }
            }
        }
        if (!empty($newrates)) {
            $this->rates = $newrates;
            $this->base = $currency;
        }

        return $this;
    }
public function convertBaseRateToCurrency ( string $ currency ) : Rates { if ( ! empty ( $ this -> rates ) ) { if ( $ this -> base !== $ currency ) { if ( ! empty ( $ this -> rates [ $ currency ] ) ) { $ usdrate = $ this -> rates [ $ currency ] ; foreach ( $ this -> rates as $ key => $ rate ) { $ newrates [ $ key ] = $ rate * ( 1 / $ usdrate ) ; } } } } if ( ! empty ( $ newrates ) ) { $ this -> rates = $ newrates ; $ this -> base = $ currency ; } return $ this ; }
Convert rates to new currency

@param string $currency

@return Rates
Convert rates to new currency