<?php
class Currency {
public static function getRates() {
// TODO: use cached file if it newer than once a day. Else ask API for new data.
$url = 'https://www.cbr-xml-daily.ru/daily_json.js';
$currenciesJson = json_decode( file_get_contents( $url ) );
return $currenciesJson->Valute;
}
}