Advertisement
Guest User

Untitled

a guest
Apr 20th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. <?php
  2.  
  3. namespace App\Utility;
  4.  
  5.  
  6. use App\Entity\ExchangeRate;
  7. use DateTime;
  8.  
  9. class Utility
  10. {
  11. //... Declaration of Constants
  12.  
  13. //... Declaration of curlExchangeRates function
  14.  
  15. //... Declaration of processExchangeRates function
  16.  
  17. //... getExchangeRateArray function
  18.  
  19. public function getExchangeRates(DateTime $earliestDate = null): array
  20. {
  21. $curlResponse = $this->curlExchangeRates();
  22. if (!$curlResponse) return []; //if something went wrong with curlExchangeRates, return an empty array
  23. $rateString = $this->processExchangeRates($curlResponse, $earliestDate);
  24. return $this->getExchangeRateArray($rateString);
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement