@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | { |
| 44 | 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 | |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | { |
| 82 | 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; |
@@ -114,15 +114,19 @@ discard block |
||
| 114 | 114 | { |
| 115 | 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) { |
|
| 118 | + throw new Exception\InvalidArgumentException('Invalid data. Please enter a valid country or currency name'); |
|
| 119 | + } |
|
| 120 | + } else if(is_array($data)){ |
|
| 119 | 121 | $value = array(); |
| 120 | 122 | foreach($data as $single){ |
| 121 | 123 | $opt = $this->validateInput($single); |
| 122 | - if($opt===false) throw new Exception\InvalidArgumentException('Invalid data. Please enter array with a valid country or currency names'); |
|
| 124 | + if($opt===false) { |
|
| 125 | + throw new Exception\InvalidArgumentException('Invalid data. Please enter array with a valid country or currency names'); |
|
| 126 | + } |
|
| 123 | 127 | array_push($value, $opt); |
| 124 | 128 | } |
| 125 | - }else{ |
|
| 129 | + } else{ |
|
| 126 | 130 | throw new Exception\InvalidArgumentException('Invalid data. Please use string or array value'); |
| 127 | 131 | } |
| 128 | 132 | return $value; |