Passed
Pull Request — master (#1)
by Patryk
01:11
created
index.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 	
3
-	require __DIR__ .'/vendor/autoload.php';
3
+	require __DIR__.'/vendor/autoload.php';
4 4
 	
5 5
 	$value = new CConverter\Converter('YOUR_API_KEY');
6 6
 	echo $value->cconv('EUR', 'USD');
Please login to merge, or discard this patch.
src/Calculate/CalculateInterface.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -5,15 +5,15 @@
 block discarded – undo
5 5
 interface CalculateInterface
6 6
 {
7 7
 	/**
8
-         * currency conversion, cache check and fixer.io api connection
9
-         *
10
-         * @param  string|array   $getFrom
8
+	 * currency conversion, cache check and fixer.io api connection
9
+	 *
10
+	 * @param  string|array   $getFrom
11 11
 	 * @param  string|array   $getTo
12 12
 	 * @param  float          $amount
13 13
 	 * @param  int            $short
14 14
 	 * @param  bool 		  $isCache
15 15
 	 * @param  int   		  $cacheTime
16
-         * @return string|array
17
-         */
16
+	 * @return string|array
17
+	 */
18 18
 	public function getValues($from, $to, $amount, $short, $isCache, $cacheTime);
19 19
 }
Please login to merge, or discard this patch.
src/Calculate/Calculate.php 3 patches
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -7,21 +7,21 @@  discard block
 block discarded – undo
7 7
 class Calculate implements CalculateInterface
8 8
 {
9 9
 	/**
10
-         * @var contains fixer.io api key string
11
-         */
10
+	 * @var contains fixer.io api key string
11
+	 */
12 12
 	protected $api_key;
13 13
 	
14 14
 	/**
15
-         * @const contains fixer.io API URL
16
-         */
15
+	 * @const contains fixer.io API URL
16
+	 */
17 17
 	const API_URL = "http://data.fixer.io/api/latest";
18 18
 	
19 19
 	/**
20
-         * get api key
21
-         *
22
-         * @param  string $key
23
-         * @return bool
24
-         */
20
+	 * get api key
21
+	 *
22
+	 * @param  string $key
23
+	 * @return bool
24
+	 */
25 25
 	public function __construct($key)
26 26
 	{
27 27
 		$this->api_key = $key;
@@ -30,12 +30,12 @@  discard block
 block discarded – undo
30 30
 	}
31 31
 	
32 32
 	/**
33
-         * change or not float decimals
34
-         *
35
-         * @param  float $calc
33
+	 * change or not float decimals
34
+	 *
35
+	 * @param  float $calc
36 36
 	 * @param  int   $short
37
-         * @return float
38
-         */
37
+	 * @return float
38
+	 */
39 39
 	public static function roundValue($calc, $short)
40 40
 	{
41 41
 		if($short){ $number = 2; }else{ $number = 5; }
@@ -45,16 +45,16 @@  discard block
 block discarded – undo
45 45
 	}
46 46
 	
47 47
 	/**
48
-         * currency conversion, cache check and fixer.io api connection
49
-         *
50
-         * @param  string|array   $getFrom
48
+	 * currency conversion, cache check and fixer.io api connection
49
+	 *
50
+	 * @param  string|array   $getFrom
51 51
 	 * @param  string|array   $getTo
52 52
 	 * @param  float          $amount
53 53
 	 * @param  int            $short
54 54
 	 * @param  bool 		  $isCache
55 55
 	 * @param  int   		  $cacheTime
56
-         * @return string|array
57
-         */
56
+	 * @return string|array
57
+	 */
58 58
 	public function getValues($getFrom, $getTo, $amount, $short, $isCache, $cacheTime)
59 59
 	{
60 60
 		if($isCache && CacheFile::isCacheDir()){
@@ -118,11 +118,11 @@  discard block
 block discarded – undo
118 118
 	
119 119
 	/**
120 120
 	 * validate errors in conncection with fixer.io api
121
-         *
121
+	 *
122 122
 	 * @param  string|array	 $data
123
-         * @return bool
123
+	 * @return bool
124 124
 	 * @throws Exception\InvalidArgumentException
125
-         */
125
+	 */
126 126
 	public function validateErrors($data)
127 127
 	{
128 128
 		if(!$data->success){
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 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;
@@ -57,60 +57,60 @@  discard block
 block discarded – undo
57 57
          */
58 58
 	public function getValues($getFrom, $getTo, $amount, $short, $isCache, $cacheTime)
59 59
 	{
60
-		if($isCache && CacheFile::isCacheDir()){
61
-			if(CacheFile::isFile()){
60
+		if ($isCache && CacheFile::isCacheDir()) {
61
+			if (CacheFile::isFile()) {
62 62
 				$file = CacheFile::getFileName();
63
-				if(CacheFile::isCurrent($file)){
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);
77 77
 		
78
-		if($this->validateErrors($data)){
79
-			if(is_array($getFrom) || is_array($getTo)){
78
+		if ($this->validateErrors($data)) {
79
+			if (is_array($getFrom) || is_array($getTo)) {
80 80
 				$newArray = array();
81 81
 				
82
-				if(is_array($getFrom)){
83
-					if(is_array($getTo)){
84
-						foreach($getFrom as $currency){
82
+				if (is_array($getFrom)) {
83
+					if (is_array($getTo)) {
84
+						foreach ($getFrom as $currency) {
85 85
 							$getA = $data->rates->$currency;
86
-							foreach($getTo as $currency2){
86
+							foreach ($getTo as $currency2) {
87 87
 								$getB = $data->rates->$currency2;
88
-								$calc = Calculate::roundValue(($amount * $getB)/$getA, $short);
88
+								$calc = Calculate::roundValue(($amount*$getB)/$getA, $short);
89 89
 								array_push($newArray, array($currency, array($currency2 => $calc)));
90 90
 							}
91 91
 						}
92
-					}else{
93
-						foreach($getFrom as $currency){
92
+					}else {
93
+						foreach ($getFrom as $currency) {
94 94
 							$getA = $data->rates->$currency;
95 95
 							$getB = $data->rates->$getTo;
96
-							$calc = Calculate::roundValue(($amount * $getB)/$getA, $short);
96
+							$calc = Calculate::roundValue(($amount*$getB)/$getA, $short);
97 97
 							array_push($newArray, array($currency, array($getTo => $calc)));
98 98
 						}
99 99
 					}
100
-				}else{
101
-					foreach($getTo as $currency){
100
+				}else {
101
+					foreach ($getTo as $currency) {
102 102
 						$getA = $data->rates->$getFrom;
103 103
 						$getB = $data->rates->$currency;
104
-						$calc = Calculate::roundValue(($amount * $getB)/$getA, $short);
104
+						$calc = Calculate::roundValue(($amount*$getB)/$getA, $short);
105 105
 						array_push($newArray, array($getFrom, array($currency => $calc)));
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
 				
113
-				$output = Calculate::roundValue(($amount * $getB)/$getA, $short);
113
+				$output = Calculate::roundValue(($amount*$getB)/$getA, $short);
114 114
 			}
115 115
 		}
116 116
 		return $output;
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
          */
126 126
 	public function validateErrors($data)
127 127
 	{
128
-		if(!$data->success){
128
+		if (!$data->success) {
129 129
 			$getErrorCode = $data->error->code;
130 130
 			$getErrorInfo = $data->error->info;
131 131
 			throw new \InvalidArgumentException("[$getErrorCode] $getErrorInfo");
Please login to merge, or discard this 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/ConverterCurrency.php 3 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -7,10 +7,10 @@  discard block
 block discarded – undo
7 7
 	/**
8 8
 	 * country code and currency code contains gold, silver and bitcoin currency
9 9
 	 *
10
-         * @var array
11
-         */
10
+	 * @var array
11
+	 */
12 12
 	protected static $countrys = array(
13
-        'AED' => 'AE',
13
+		'AED' => 'AE',
14 14
 		'AFN' => 'AF',
15 15
 		'ALL' => 'AL',
16 16
 		'AMD' => 'AM',
@@ -178,14 +178,14 @@  discard block
 block discarded – undo
178 178
 		'ZMK' => 'ZM',
179 179
 		'ZMW' => 'ZM',
180 180
 		'ZWL' => 'ZW'
181
-    );
181
+	);
182 182
 	
183 183
 	/**
184 184
 	 * check currency code and transform country code to currency code
185
-         *
185
+	 *
186 186
 	 * @param  string|array	 $data
187
-         * @return string|array|bool
188
-         */
187
+	 * @return string|array|bool
188
+	 */
189 189
 	public static function getCurrency($data)
190 190
 	{
191 191
 		$base = array_flip(self::$countrys);
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -189,20 +189,20 @@
 block discarded – undo
189 189
 	public static function getCurrency($data)
190 190
 	{
191 191
 		$base = array_flip(self::$countrys);
192
-		if(strlen($data)==2){
193
-			if(array_key_exists($data, $base)) {
194
-				foreach($base as $key => $value){
195
-					if($key==$data) $output = $value;
192
+		if (strlen($data)==2) {
193
+			if (array_key_exists($data, $base)) {
194
+				foreach ($base as $key => $value) {
195
+					if ($key==$data) $output = $value;
196 196
 				}
197
-			}else{
197
+			}else {
198 198
 				$output = false;
199 199
 			}
200
-		}else if(strlen($data)==3){
201
-			foreach($base as $key => $value){
202
-				if($value==$data) $output = $value;
200
+		}else if (strlen($data)==3) {
201
+			foreach ($base as $key => $value) {
202
+				if ($value==$data) $output = $value;
203 203
 			}
204
-			if(!$output) $output = false;
205
-		}else{
204
+			if (!$output) $output = false;
205
+		}else {
206 206
 			$outut = false;
207 207
 		}
208 208
 		return $output;
Please login to merge, or discard this patch.
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -192,17 +192,23 @@
 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
-			}else{
199
+			} else{
198 200
 				$output = false;
199 201
 			}
200
-		}else if(strlen($data)==3){
202
+		} else if(strlen($data)==3){
201 203
 			foreach($base as $key => $value){
202
-				if($value==$data) $output = $value;
204
+				if($value==$data) {
205
+					$output = $value;
206
+				}
207
+			}
208
+			if(!$output) {
209
+				$output = false;
203 210
 			}
204
-			if(!$output) $output = false;
205
-		}else{
211
+		} else{
206 212
 			$outut = false;
207 213
 		}
208 214
 		return $output;
Please login to merge, or discard this patch.
src/Converter.php 3 patches
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -8,37 +8,37 @@  discard block
 block discarded – undo
8 8
 class Converter implements ConverterInterface
9 9
 {
10 10
 	/**
11
-         * @var contains fixer.io api key string
12
-         */
11
+	 * @var contains fixer.io api key string
12
+	 */
13 13
 	protected $api_key;
14 14
 	
15 15
 	/**
16 16
 	 * sortage api key lenght 
17 17
 	 *
18
-         * @var int
19
-         */
18
+	 * @var int
19
+	 */
20 20
 	public $api_length = 32;
21 21
 	
22 22
 	/**
23 23
 	 * sortage cache or not 
24
- 	 *
25
-         * @var bool
26
-         */
24
+	 *
25
+	 * @var bool
26
+	 */
27 27
 	public $isCache = false;
28 28
 	
29 29
 	/**
30 30
 	 * contains storage cache in minutes
31 31
 	 *
32
-         * @var int
33
-         */
32
+	 * @var int
33
+	 */
34 34
 	public $cacheTime = 60;
35 35
 	
36 36
 	/**
37
-         * connect with API fixer.io
38
-         *
39
-         * @param  string $api_key
40
-         * @return bool
41
-         */
37
+	 * connect with API fixer.io
38
+	 *
39
+	 * @param  string $api_key
40
+	 * @return bool
41
+	 */
42 42
 	public function __construct($api_key)
43 43
 	{
44 44
 		if(strlen($api_key)==$this->api_length){
@@ -52,13 +52,13 @@  discard block
 block discarded – undo
52 52
 	
53 53
 	/**
54 54
 	 * initial currency conversion
55
-         *
56
-         * @param  string|array $from
55
+	 *
56
+	 * @param  string|array $from
57 57
 	 * @param  string|array $to
58 58
 	 * @param  float 		$amount
59 59
 	 * @param  bool			$short
60
-         * @return string|array
61
-         */
60
+	 * @return string|array
61
+	 */
62 62
 	public function cconv($from, $to, $amount = 1, $short = false)
63 63
 	{
64 64
 		$getFrom = $this->checkInput($from);
@@ -73,10 +73,10 @@  discard block
 block discarded – undo
73 73
 	
74 74
 	/**
75 75
 	 * validate input data
76
-         *
76
+	 *
77 77
 	 * @param  string $data
78
-         * @return bool
79
-         */
78
+	 * @return bool
79
+	 */
80 80
 	public function validateInput($data)
81 81
 	{
82 82
 		if(strlen($data)==2 || strlen($data)==3){
@@ -89,11 +89,11 @@  discard block
 block discarded – undo
89 89
 	
90 90
 	/**
91 91
 	 * initial cache or not
92
-         *
92
+	 *
93 93
 	 * @param  bool	 $is
94 94
 	 * @param  int	 $time
95
-         * @return bool
96
-         */
95
+	 * @return bool
96
+	 */
97 97
 	public function cache($is = false, $time = 60)
98 98
 	{
99 99
 		$parm = Cache::setCache($is, $time);
@@ -105,11 +105,11 @@  discard block
 block discarded – undo
105 105
 	
106 106
 	/**
107 107
 	 * check input data for validator
108
-         *
108
+	 *
109 109
 	 * @param  string|array	 $data
110
-         * @return string|array
110
+	 * @return string|array
111 111
 	 * @throws Exception\InvalidArgumentException
112
-         */
112
+	 */
113 113
 	protected function checkInput($data)
114 114
 	{
115 115
 		if(is_string($data)){
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -41,9 +41,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this 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/ConverterInterface.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -6,12 +6,12 @@
 block discarded – undo
6 6
 {
7 7
 	/**
8 8
 	 * initial currency conversion
9
-         *
10
-         * @param  string|array $from
9
+	 *
10
+	 * @param  string|array $from
11 11
 	 * @param  string|array $to
12 12
 	 * @param  float 		$amount
13 13
 	 * @param  bool			$short
14
-         * @return string|array
15
-         */
14
+	 * @return string|array
15
+	 */
16 16
 	public function cconv($from, $to, $amount);
17 17
 }
Please login to merge, or discard this patch.
src/Cache/CacheFile.php 3 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -6,9 +6,9 @@  discard block
 block discarded – undo
6 6
 {
7 7
 	/**
8 8
 	 * check if is cache dir
9
-         *
10
-         * @return bool
11
-         */
9
+	 *
10
+	 * @return bool
11
+	 */
12 12
 	public static function isCacheDir()
13 13
 	{
14 14
 		if(!is_dir(__DIR__ .'/cache/')) mkdir(__DIR__ ."/cache/", 0700);
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
 	
19 19
 	/**
20 20
 	 * check if cache file exists
21
-         *
22
-         * @return bool
23
-         */
21
+	 *
22
+	 * @return bool
23
+	 */
24 24
 	public static function isFile()
25 25
 	{
26 26
 		$files = glob(__DIR__ .'/cache/*.txt');
@@ -36,9 +36,9 @@  discard block
 block discarded – undo
36 36
 	
37 37
 	/**
38 38
 	 *  get name of cache file
39
-         *
40
-         * @return string
41
-         */
39
+	 *
40
+	 * @return string
41
+	 */
42 42
 	public static function getFileName()
43 43
 	{
44 44
 		$files = glob(__DIR__ .'/cache/*.txt');
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
 	
52 52
 	/**
53 53
 	 *  check if cache file is needed to update
54
-         *
55
-         * @return bool
56
-         */
54
+	 *
55
+	 * @return bool
56
+	 */
57 57
 	public static function isCurrent($file)
58 58
 	{
59 59
 		$getSourceName = explode(".", $file);
@@ -71,12 +71,12 @@  discard block
 block discarded – undo
71 71
 	
72 72
 	/**
73 73
 	 *  create new cache file
74
-         *
74
+	 *
75 75
 	 * @param  string        $file
76 76
 	 * @param  array         $data
77 77
 	 * @param  int           $time
78
-         * @return bool
79
-         */
78
+	 * @return bool
79
+	 */
80 80
 	public static function setNewCacheFile($file, $data, $time)
81 81
 	{
82 82
 		if($file) unlink(__DIR__ .'/cache/'.$file);
@@ -92,9 +92,9 @@  discard block
 block discarded – undo
92 92
 	
93 93
 	/**
94 94
 	 *  get cache data
95
-         *
96
-         * @return array
97
-         */
95
+	 *
96
+	 * @return array
97
+	 */
98 98
 	public static function getCache($file)
99 99
 	{
100 100
 		$data = file_get_contents(__DIR__ .'/cache/'.$file);
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  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/')) mkdir(__DIR__."/cache/", 0700);
15 15
 		
16 16
 		return true;
17 17
 	}
@@ -23,11 +23,11 @@  discard block
 block discarded – undo
23 23
          */
24 24
 	public static function isFile()
25 25
 	{
26
-		$files = glob(__DIR__ .'/cache/*.txt');
26
+		$files = glob(__DIR__.'/cache/*.txt');
27 27
 		$count = count($files);
28
-		if($count>0){
28
+		if ($count>0) {
29 29
 			$output = true;
30
-		}else{
30
+		}else {
31 31
 			$output = false;
32 32
 		}
33 33
 		
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
          */
42 42
 	public static function getFileName()
43 43
 	{
44
-		$files = glob(__DIR__ .'/cache/*.txt');
44
+		$files = glob(__DIR__.'/cache/*.txt');
45 45
 		$file = $files[0];
46 46
 		$fileName = explode("/cache/", $file);
47 47
 		$fileName = $fileName[1];
@@ -60,9 +60,9 @@  discard block
 block discarded – undo
60 60
 		$getSourceName = $getSourceName[0];
61 61
 		
62 62
 		$current_time = time();
63
-		if($current_time>$getSourceName){
63
+		if ($current_time>$getSourceName) {
64 64
 			$output = false;
65
-		}else{
65
+		}else {
66 66
 			$output = true;
67 67
 		}
68 68
 		
@@ -79,13 +79,13 @@  discard block
 block discarded – undo
79 79
          */
80 80
 	public static function setNewCacheFile($file, $data, $time)
81 81
 	{
82
-		if($file) unlink(__DIR__ .'/cache/'.$file);
82
+		if ($file) unlink(__DIR__.'/cache/'.$file);
83 83
 		
84 84
 		$current_time = time();
85 85
 		$new_time = $current_time + $time*60;
86 86
 		
87 87
 		$file_name = $new_time.".txt";
88
-		file_put_contents(__DIR__ .'/cache/'.$file_name, $data);
88
+		file_put_contents(__DIR__.'/cache/'.$file_name, $data);
89 89
 		
90 90
 		return true;
91 91
 	}
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
          */
98 98
 	public static function getCache($file)
99 99
 	{
100
-		$data = file_get_contents(__DIR__ .'/cache/'.$file);
100
+		$data = file_get_contents(__DIR__.'/cache/'.$file);
101 101
 		
102 102
 		return $data;
103 103
 	}
Please login to merge, or discard this 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/CacheInterface.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -6,10 +6,10 @@
 block discarded – undo
6 6
 {
7 7
 	/**
8 8
 	 * change cache parameter
9
-         *
10
-         * @param  bool $is
9
+	 *
10
+	 * @param  bool $is
11 11
 	 * @param  int  $time
12
-         * @return bool
13
-         */
12
+	 * @return bool
13
+	 */
14 14
 	public static function setCache($is, $time);
15 15
 }
Please login to merge, or discard this patch.
src/Cache/Cache.php 3 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -6,11 +6,11 @@
 block discarded – undo
6 6
 {
7 7
 	/**
8 8
 	 * change cache parameter
9
-         *
10
-         * @param  bool $is
9
+	 *
10
+	 * @param  bool $is
11 11
 	 * @param  int  $time
12
-         * @return bool
13
-         */
12
+	 * @return bool
13
+	 */
14 14
 	public static function setCache($is, $time)
15 15
 	{
16 16
 		if($is==true && is_numeric($time) && is_int($time)){
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,9 +13,9 @@
 block discarded – undo
13 13
          */
14 14
 	public static function setCache($is, $time)
15 15
 	{
16
-		if($is==true && is_numeric($time) && is_int($time)){
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.
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.