@@ -41,9 +41,9 @@ discard block |
||
| 41 | 41 | */ |
| 42 | 42 | public function __construct($api_key) |
| 43 | 43 | { |
| 44 | - if(strlen($api_key)==$this->api_length){ |
|
| 44 | + if (strlen($api_key)==$this->api_length) { |
|
| 45 | 45 | $this->api_key = $api_key; |
| 46 | - }else{ |
|
| 46 | + }else { |
|
| 47 | 47 | throw new Exception\InvalidArgumentException('Invalid length of API KEY'); |
| 48 | 48 | } |
| 49 | 49 | |
@@ -79,9 +79,9 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | public function validateInput($data) |
| 81 | 81 | { |
| 82 | - if(strlen($data)==2 || strlen($data)==3){ |
|
| 82 | + if (strlen($data)==2 || strlen($data)==3) { |
|
| 83 | 83 | $output = ConverterCurrency::getCurrency($data); |
| 84 | - }else{ |
|
| 84 | + }else { |
|
| 85 | 85 | $output = false; |
| 86 | 86 | } |
| 87 | 87 | return $output; |
@@ -112,17 +112,17 @@ discard block |
||
| 112 | 112 | */ |
| 113 | 113 | protected function checkInput($data) |
| 114 | 114 | { |
| 115 | - if(is_string($data)){ |
|
| 115 | + if (is_string($data)) { |
|
| 116 | 116 | $value = $this->validateInput($data); |
| 117 | - if($value===false) throw new Exception\InvalidArgumentException('Invalid data. Please enter a valid country or currency name'); |
|
| 118 | - }else if(is_array($data)){ |
|
| 117 | + if ($value===false) throw new Exception\InvalidArgumentException('Invalid data. Please enter a valid country or currency name'); |
|
| 118 | + }else if (is_array($data)) { |
|
| 119 | 119 | $value = array(); |
| 120 | - foreach($data as $single){ |
|
| 120 | + foreach ($data as $single) { |
|
| 121 | 121 | $opt = $this->validateInput($single); |
| 122 | - if($opt===false) throw new Exception\InvalidArgumentException('Invalid data. Please enter array with a valid country or currency names'); |
|
| 122 | + if ($opt===false) throw new Exception\InvalidArgumentException('Invalid data. Please enter array with a valid country or currency names'); |
|
| 123 | 123 | array_push($value, $opt); |
| 124 | 124 | } |
| 125 | - }else{ |
|
| 125 | + }else { |
|
| 126 | 126 | throw new Exception\InvalidArgumentException('Invalid data. Please use string or array value'); |
| 127 | 127 | } |
| 128 | 128 | return $value; |