Passed
Push — master ( 675a0a...e75eaf )
by Patryk
01:50
created
src/Calculate/Calculate.php 1 patch
Braces   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
          */
39 39
 	public static function roundValue($calc, $short)
40 40
 	{
41
-		if($short){ $number = 2; }else{ $number = 5; }
41
+		if($short){ $number = 2; } else{ $number = 5; }
42 42
 		$output = round($calc, $number);
43 43
 		
44 44
 		return $output;
@@ -62,15 +62,15 @@  discard block
 block discarded – undo
62 62
 				$file = CacheFile::getFileName();
63 63
 				if(CacheFile::isCurrent($file)){
64 64
 					$data = CacheFile::getCache($file);
65
-				}else{
65
+				} else{
66 66
 					$data = file_get_contents(self::API_URL."?access_key=".$this->api_key);
67 67
 					CacheFile::setNewCacheFile($file, $data, $cacheTime);
68 68
 				}
69
-			}else{
69
+			} else{
70 70
 				$data = file_get_contents(self::API_URL."?access_key=".$this->api_key);
71 71
 				CacheFile::setNewCacheFile(false, $data, $cacheTime);
72 72
 			}
73
-		}else{
73
+		} else{
74 74
 			$data = file_get_contents(self::API_URL."?access_key=".$this->api_key);
75 75
 		}
76 76
 		$data = json_decode($data);
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 								array_push($newArray, array($currency, array($currency2 => $calc)));
90 90
 							}
91 91
 						}
92
-					}else{
92
+					} else{
93 93
 						foreach($getFrom as $currency){
94 94
 							$getA = $data->rates->$currency;
95 95
 							$getB = $data->rates->$getTo;
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 							array_push($newArray, array($currency, array($getTo => $calc)));
98 98
 						}
99 99
 					}
100
-				}else{
100
+				} else{
101 101
 					foreach($getTo as $currency){
102 102
 						$getA = $data->rates->$getFrom;
103 103
 						$getB = $data->rates->$currency;
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 					}
107 107
 				}
108 108
 				$output = $newArray;
109
-			}else{
109
+			} else{
110 110
 				$getA = $data->rates->$getFrom;
111 111
 				$getB = $data->rates->$getTo;
112 112
 				
Please login to merge, or discard this patch.
src/Converter.php 1 patch
Braces   +10 added lines, -6 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/Cache/CacheFile.php 1 patch
Braces   +8 added lines, -4 removed lines patch added patch discarded remove patch
@@ -11,7 +11,9 @@  discard block
 block discarded – undo
11 11
          */
12 12
 	public static function isCacheDir()
13 13
 	{
14
-		if(!is_dir(__DIR__ .'/cache/')) mkdir(__DIR__ ."/cache/", 0700);
14
+		if(!is_dir(__DIR__ .'/cache/')) {
15
+			mkdir(__DIR__ ."/cache/", 0700);
16
+		}
15 17
 		
16 18
 		return true;
17 19
 	}
@@ -27,7 +29,7 @@  discard block
 block discarded – undo
27 29
 		$count = count($files);
28 30
 		if($count>0){
29 31
 			$output = true;
30
-		}else{
32
+		} else{
31 33
 			$output = false;
32 34
 		}
33 35
 		
@@ -62,7 +64,7 @@  discard block
 block discarded – undo
62 64
 		$current_time = time();
63 65
 		if($current_time>$getSourceName){
64 66
 			$output = false;
65
-		}else{
67
+		} else{
66 68
 			$output = true;
67 69
 		}
68 70
 		
@@ -79,7 +81,9 @@  discard block
 block discarded – undo
79 81
          */
80 82
 	public static function setNewCacheFile($file, $data, $time)
81 83
 	{
82
-		if($file) unlink(__DIR__ .'/cache/'.$file);
84
+		if($file) {
85
+			unlink(__DIR__ .'/cache/'.$file);
86
+		}
83 87
 		
84 88
 		$current_time = time();
85 89
 		$new_time = $current_time + $time*60;
Please login to merge, or discard this patch.
src/Cache/Cache.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
 	{
16 16
 		if($is==true && is_numeric($time) && is_int($time)){
17 17
 			$output = true;
18
-		}else{
18
+		} else{
19 19
 			$output = false;
20 20
 		}
21 21
 		return $output;
Please login to merge, or discard this patch.
src/ConverterCurrency.php 1 patch
Braces   +15 added lines, -7 removed lines patch added patch discarded remove patch
@@ -192,18 +192,26 @@
 block discarded – undo
192 192
 		if(strlen($data)==2){
193 193
 			if(array_key_exists($data, $base)) {
194 194
 				foreach($base as $key => $value){
195
-					if($key==$data) $output = $value;
195
+					if($key==$data) {
196
+						$output = $value;
197
+					}
196 198
 				}
197
-				if(empty($output)) $output = false;
198
-			}else{
199
+				if(empty($output)) {
200
+					$output = false;
201
+				}
202
+			} else{
199 203
 				$output = false;
200 204
 			}
201
-		}else if(strlen($data)==3){
205
+		} else if(strlen($data)==3){
202 206
 			foreach($base as $key => $value){
203
-				if($value==$data) $output = $value;
207
+				if($value==$data) {
208
+					$output = $value;
209
+				}
210
+			}
211
+			if(empty($output)) {
212
+				$output = false;
204 213
 			}
205
-			if(empty($output)) $output = false;
206
-		}else{
214
+		} else{
207 215
 			$output = false;
208 216
 		}
209 217
 		return $output;
Please login to merge, or discard this patch.