Changeset View
Changeset View
Standalone View
Standalone View
src/app/Backends/OpenExchangeRates.php
<?php | <?php | ||||
namespace App\Backends; | namespace App\Backends; | ||||
class OpenExchangeRates | class OpenExchangeRates | ||||
{ | { | ||||
/** | /** | ||||
* Import exchange rates from openexchangerates.org | * Import exchange rates from openexchangerates.org | ||||
* | * | ||||
* @param string Base currency | * @param string $baseCurrency Base currency | ||||
* | * | ||||
* @return array exchange rates | * @return array exchange rates | ||||
*/ | */ | ||||
public static function retrieveRates($baseCurrency) | public static function retrieveRates($baseCurrency) | ||||
{ | { | ||||
$baseCurrency = strtoupper($baseCurrency); | $baseCurrency = strtoupper($baseCurrency); | ||||
$apiKey = \config('services.openexchangerates.api_key'); | $apiKey = \config('services.openexchangerates.api_key'); | ||||
$query = http_build_query(['app_id' => $apiKey, 'base' => 'USD']); | $query = http_build_query(['app_id' => $apiKey, 'base' => 'USD']); | ||||
Show All 34 Lines |