コード例 #1
0
 public function convert($from, $to, $amount)
 {
     parent::makeRequest();
     $rateFrom = $this->getRate($from);
     $rateTo = $this->getRate($to);
     return $amount / $rateFrom * $rateTo;
 }
コード例 #2
0
 public function __construct(CacheInterface $cache = null, ClientInterface $client = null, AdapterInterface $adapter = null)
 {
     if (is_null($cache)) {
         $cache = new MemcacheCache();
     }
     if (is_null($client)) {
         $client = new EcbClient($cache);
     }
     if (is_null($adapter)) {
         $adapter = new EcbToArrayAdapter();
     }
     $this->client = $client;
     $this->adapter = $adapter;
     $this->path = 'http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml';
     parent::makeRequest();
 }