@@ -19,7 +19,9 @@ discard block |
||
| 19 | 19 | |
| 20 | 20 | public function getConvRate($from_currency, $to_currency) |
| 21 | 21 | { |
| 22 | - if ($from_currency == $to_currency) return 1.0; |
|
| 22 | + if ($from_currency == $to_currency) { |
|
| 23 | + return 1.0; |
|
| 24 | + } |
|
| 23 | 25 | |
| 24 | 26 | $conversion_rate = 0.0; |
| 25 | 27 | |
@@ -28,7 +30,9 @@ discard block |
||
| 28 | 30 | $full_url = 'http://api.exchangeratesapi.io/v1/convert?access_key=' . $this->api_key . '&from=' . $from_currency . '&to=' . $to_currency; |
| 29 | 31 | $remote = new Remote(); |
| 30 | 32 | $result = $remote->getFileContents($full_url); |
| 31 | - if ($result === false) return false; |
|
| 33 | + if ($result === false) { |
|
| 34 | + return false; |
|
| 35 | + } |
|
| 32 | 36 | $json_result = json_decode($result, true); |
| 33 | 37 | $conversion_rate = $json_result['rates'][$to_currency]; |
| 34 | 38 | |
@@ -37,7 +41,9 @@ discard block |
||
| 37 | 41 | $full_url = 'https://v6.exchangerate-api.com/v6/' . $this->api_key . '/pair/' . $from_currency . '/' . $to_currency; |
| 38 | 42 | $remote = new Remote(); |
| 39 | 43 | $result = $remote->getFileContents($full_url); |
| 40 | - if ($result === false) return false; |
|
| 44 | + if ($result === false) { |
|
| 45 | + return false; |
|
| 46 | + } |
|
| 41 | 47 | $json_result = json_decode($result, true); |
| 42 | 48 | $conversion_rate = $json_result['conversion_rate']; |
| 43 | 49 | |
@@ -46,7 +52,9 @@ discard block |
||
| 46 | 52 | $full_url = 'http://data.fixer.io/api/convert?access_key=' . $this->api_key . '&from=' . $from_currency . '&to=' . $to_currency; |
| 47 | 53 | $remote = new Remote(); |
| 48 | 54 | $result = $remote->getFileContents($full_url); |
| 49 | - if ($result === false) return false; |
|
| 55 | + if ($result === false) { |
|
| 56 | + return false; |
|
| 57 | + } |
|
| 50 | 58 | $json_result = json_decode($result, true); |
| 51 | 59 | $conversion_rate = $json_result['rates'][$to_currency]; |
| 52 | 60 | |
@@ -55,7 +63,9 @@ discard block |
||
| 55 | 63 | $full_url = 'https://api.interzoid.com/convertcurrency?license=' . $this->api_key . '&from=' . $from_currency . '&to=' . $to_currency . '&amount=1'; |
| 56 | 64 | $remote = new Remote(); |
| 57 | 65 | $result = $remote->getFileContents($full_url); |
| 58 | - if ($result === false) return false; |
|
| 66 | + if ($result === false) { |
|
| 67 | + return false; |
|
| 68 | + } |
|
| 59 | 69 | $json_result = json_decode($result, true); |
| 60 | 70 | $conversion_rate = $json_result['Converted']; |
| 61 | 71 | |
@@ -64,7 +74,9 @@ discard block |
||
| 64 | 74 | $full_url = 'https://api.exchangerate.host/convert?from=' . $from_currency . '&to=' . $to_currency; |
| 65 | 75 | $remote = new Remote(); |
| 66 | 76 | $result = $remote->getFileContents($full_url); |
| 67 | - if ($result === false) return false; |
|
| 77 | + if ($result === false) { |
|
| 78 | + return false; |
|
| 79 | + } |
|
| 68 | 80 | $json_result = json_decode($result, true); |
| 69 | 81 | $conversion_rate = $json_result['info']['rate']; |
| 70 | 82 | |