Test Failed
Branch master (ae38c4)
by Eric Claver
11:34
created
src/Utils/UserAgent.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -83,12 +83,10 @@
 block discarded – undo
83 83
 		if(filter_var($client, FILTER_VALIDATE_IP))
84 84
 		{
85 85
 			$ip = $client;
86
-		}
87
-		elseif(filter_var($forward, FILTER_VALIDATE_IP))
86
+		} elseif(filter_var($forward, FILTER_VALIDATE_IP))
88 87
 		{
89 88
 			$ip = $forward;
90
-		}
91
-		else
89
+		} else
92 90
 		{
93 91
 			$ip = $remote;
94 92
 		}
Please login to merge, or discard this patch.
src/Utils/CsvParser.php 1 patch
Braces   +10 added lines, -15 removed lines patch added patch discarded remove patch
@@ -52,8 +52,7 @@  discard block
 block discarded – undo
52 52
 		if(! $filepath)
53 53
 		{
54 54
 			$filepath = $this->_get_filepath();    
55
-		}
56
-		else
55
+		} else
57 56
 		{   
58 57
 			// If filepath provided, set it
59 58
 			$this->_set_filepath($filepath);
@@ -69,8 +68,7 @@  discard block
 block discarded – undo
69 68
 		if(! $detect_line_endings)
70 69
 		{
71 70
 			$detect_line_endings = $this->_get_detect_line_endings();    
72
-		}
73
-		else
71
+		} else
74 72
 		{   
75 73
 			// If detect_line_endings provided, set it
76 74
 			$this->_set_detect_line_endings($detect_line_endings);
@@ -86,8 +84,7 @@  discard block
 block discarded – undo
86 84
 		if(! $initial_line)
87 85
 		{
88 86
 			$initial_line = $this->_get_initial_line();    
89
-		}
90
-		else
87
+		} else
91 88
 		{
92 89
 			$this->_set_initial_line($initial_line);
93 90
 		}
@@ -96,8 +93,7 @@  discard block
 block discarded – undo
96 93
 		if(! $delimiter)
97 94
 		{
98 95
 			$delimiter = $this->_get_delimiter();    
99
-		}
100
-		else
96
+		} else
101 97
 		{   
102 98
 			// If delimiter provided, set it
103 99
 			$this->_set_delimiter($delimiter);
@@ -107,8 +103,7 @@  discard block
 block discarded – undo
107 103
 		if(! $column_headers)
108 104
 		{
109 105
 			$column_headers = $this->_get_column_headers();    
110
-		}
111
-		else
106
+		} else
112 107
 		{
113 108
 			// If column headers provided, set them
114 109
 			$this->_set_column_headers($column_headers);
@@ -139,22 +134,22 @@  discard block
 block discarded – undo
139 134
 						{
140 135
 							$column_headers[$key] = trim($value);
141 136
 						}
142
-					}
143
-					else // Parse first row for column_headers to use
137
+					} else // Parse first row for column_headers to use
144 138
 					{
145 139
 						foreach ($data as $key => $value)
146 140
 						{
147 141
 							  $column_headers[$key] = trim($value);
148 142
 						}                
149 143
 					}          
150
-				}
151
-				else
144
+				} else
152 145
 				{
153 146
 					$new_row = $row - $this->initial_line - 1; // needed so that the returned array starts at 0 instead of 1
154
-					foreach($column_headers as $key => $value) // assumes there are as many columns as their are title columns
147
+					foreach($column_headers as $key => $value) {
148
+						// assumes there are as many columns as their are title columns
155 149
 					{
156 150
 					$result[$new_row][$value] = utf8_encode(trim($data[$key]));
157 151
 					}
152
+					}
158 153
 				}
159 154
             
160 155
 				unset($data);
Please login to merge, or discard this patch.
src/Extensions/Database/ezSQLcore.php 1 patch
Braces   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -233,8 +233,7 @@  discard block
 block discarded – undo
233 233
 			if ($output == OBJECT)
234 234
 			{
235 235
 				return $this->last_result;
236
-			}
237
-			elseif ($output == ARRAY_A || $output == ARRAY_N)
236
+			} elseif ($output == ARRAY_A || $output == ARRAY_N)
238 237
 			{
239 238
 				if ($this->last_result)
240 239
 				{
@@ -306,8 +305,7 @@  discard block
 block discarded – undo
306 305
 				{
307 306
 					$this->register_error("Could not open cache dir: $this->cache_dir");
308 307
 					$this->show_errors ? trigger_error("Could not open cache dir: $this->cache_dir", E_USER_WARNING) : null;
309
-				}
310
-				else
308
+				} else
311 309
 				{
312 310
 					// Cache all result values
313 311
 					$result_cache = array(
@@ -317,8 +315,9 @@  discard block
 block discarded – undo
317 315
 						'return_value' => $this->num_rows,
318 316
 					);
319 317
 					file_put_contents($cache_file, serialize($result_cache));
320
-					if (file_exists($cache_file.".updating"))
321
-						unlink($cache_file.".updating");
318
+					if (file_exists($cache_file.".updating")) {
319
+											unlink($cache_file.".updating");
320
+					}
322 321
 				}
323 322
 			}
324 323
 
@@ -342,8 +341,7 @@  discard block
 block discarded – undo
342 341
 					! (file_exists($cache_file.".updating") && (time() - filemtime($cache_file.".updating") < 60)))
343 342
 				{
344 343
 					touch($cache_file.".updating"); // Show that we in the process of updating the cache
345
-				}
346
-				else
344
+				} else
347 345
 				{
348 346
 					$result_cache = unserialize(file_get_contents($cache_file));
349 347
 
@@ -598,10 +596,12 @@  discard block
 block discarded – undo
598 596
 			$sql = array();
599 597
 			foreach ($params as $field => $val)
600 598
 			{
601
-				if ($val === 'true' || $val === true)
602
-					$val = 1;
603
-				if ($val === 'false' || $val === false)
604
-					$val = 0;
599
+				if ($val === 'true' || $val === true) {
600
+									$val = 1;
601
+				}
602
+				if ($val === 'false' || $val === false) {
603
+									$val = 0;
604
+				}
605 605
 
606 606
 				switch ($val) {
607 607
 					case 'NOW()' :
Please login to merge, or discard this patch.
src/Extensions/Database/ezSQL_mysqli.php 1 patch
Braces   +17 added lines, -11 removed lines patch added patch discarded remove patch
@@ -26,8 +26,12 @@  discard block
 block discarded – undo
26 26
 	*  ezSQL Database specific class - mySQLi
27 27
 	*/
28 28
 
29
-	if ( ! function_exists('mysqli_connect')) die('<b>Fatal Error:</b> ezSQL_mysql requires mySQLi Lib to be compiled and or linked in to the PHP engine');
30
-	if ( ! class_exists('ezSQLcore')) die('<b>Fatal Error:</b> ezSQL_mysql requires ezSQLcore (ez_sql_core.php) to be included/loaded before it can be used');
29
+	if ( ! function_exists('mysqli_connect')) {
30
+		die('<b>Fatal Error:</b> ezSQL_mysql requires mySQLi Lib to be compiled and or linked in to the PHP engine');
31
+	}
32
+	if ( ! class_exists('ezSQLcore')) {
33
+		die('<b>Fatal Error:</b> ezSQL_mysql requires ezSQLcore (ez_sql_core.php) to be included/loaded before it can be used');
34
+	}
31 35
 
32 36
 	class ezSQL_mysqli extends ezSQLcore
33 37
 	{
@@ -64,7 +68,9 @@  discard block
 block discarded – undo
64 68
 			$return_val = false;
65 69
 			if ( ! $this->connect($dbuser, $dbpassword, $dbhost, $dbport));
66 70
 			else if ( ! $this->select($dbname, $encoding));
67
-			else $return_val = true;
71
+			else {
72
+				$return_val = true;
73
+			}
68 74
 			return $return_val;
69 75
 		}
70 76
 
@@ -99,8 +105,7 @@  discard block
 block discarded – undo
99 105
 				{
100 106
 					$this->register_error($ezsql_mysqli_str[2].' in '.__FILE__.' on line '.__LINE__);
101 107
 					$this->show_errors ? trigger_error($ezsql_mysqli_str[2], E_USER_WARNING) : null;
102
-				}
103
-				else
108
+				} else
104 109
 				{
105 110
 					$this->dbuser = $dbuser;
106 111
 					$this->dbpassword = $dbpassword;
@@ -141,13 +146,13 @@  discard block
 block discarded – undo
141 146
 			else if ( ! @$this->dbh->select_db($dbname))
142 147
 			{
143 148
 				// Try to get error supplied by mysql if not use our own
144
-				if ( ! $str = @$this->dbh->error)
145
-					  $str = $ezsql_mysqli_str[5];
149
+				if ( ! $str = @$this->dbh->error) {
150
+									  $str = $ezsql_mysqli_str[5];
151
+				}
146 152
 
147 153
 				$this->register_error($str.' in '.__FILE__.' on line '.__LINE__);
148 154
 				$this->show_errors ? trigger_error($str, E_USER_WARNING) : null;
149
-			}
150
-			else
155
+			} else
151 156
 			{
152 157
 				$this->dbname = $dbname;
153 158
 				if ($encoding != '')
@@ -257,8 +262,9 @@  discard block
 block discarded – undo
257 262
 				$this->connect($this->dbuser, $this->dbpassword, $this->dbhost, $this->dbport);
258 263
 				$this->select($this->dbname, $this->encoding);
259 264
 				// No existing connection at this point means the server is unreachable
260
-				if ( ! isset($this->dbh) || ! $this->dbh || $this->dbh->connect_errno)
261
-					return false;
265
+				if ( ! isset($this->dbh) || ! $this->dbh || $this->dbh->connect_errno) {
266
+									return false;
267
+				}
262 268
 			}
263 269
 
264 270
 			// Perform the query via std mysql_query function..
Please login to merge, or discard this patch.
src/BootstrapTable.php 1 patch
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -104,20 +104,16 @@  discard block
 block discarded – undo
104 104
 				if ($order->amount_paid > 0 AND $order->order_status == 'Refunded')
105 105
 				{
106 106
 					$number_prefix = null == get_option('credit_note_prefix') ? __('credit_note_prefix').sprintf("%04s", $order->order_number) : get_option('credit_note_prefix').sprintf("%04s", $order->order_number);
107
-				}
108
-				elseif ($order->order_status == 'Refunded')
107
+				} elseif ($order->order_status == 'Refunded')
109 108
 				{
110 109
 					$number_prefix = null == get_option('credit_note_prefix') ? __('credit_note_prefix').sprintf("%04s", $order->order_number) : get_option('credit_note_prefix').sprintf("%04s", $order->order_number);
111
-				}
112
-				elseif ($order->amount_paid > 0 AND $order->amount_due > 0 AND $order->order_status !== 'Paid')
110
+				} elseif ($order->amount_paid > 0 AND $order->amount_due > 0 AND $order->order_status !== 'Paid')
113 111
 				{
114 112
 					$number_prefix = null == get_option('sale_order_prefix') ? __('sale_order_prefix_short').sprintf("%04s", $order->order_number) : get_option('sale_order_prefix').sprintf("%04s", $order->order_number);
115
-				}
116
-				elseif ($order->order_status == 'Expired' || $order->order_status == 'Open' || $order->order_status == 'Pending' || $order->order_status == 'Failed')
113
+				} elseif ($order->order_status == 'Expired' || $order->order_status == 'Open' || $order->order_status == 'Pending' || $order->order_status == 'Failed')
117 114
 				{
118 115
 					$number_prefix = null == get_option('sale_order_prefix') ? __('sale_order_prefix_short').sprintf("%04s", $order->order_number) : get_option('sale_order_prefix').sprintf("%04s", $order->order_number);
119
-				}
120
-				else
116
+				} else
121 117
 				{
122 118
 					$number_prefix = null == get_option('sale_order_prefix') ? __('sale_order_prefix_short').sprintf("%04s", $order->order_number) : get_option('sale_order_prefix').sprintf("%04s", $order->order_number);
123 119
 				}
@@ -156,8 +152,7 @@  discard block
 block discarded – undo
156 152
 				if (isset($client->client_address1) && $client->client_postcode && $client->client_city && $client->client_country)
157 153
 				{
158 154
 					$address = $client->client_address1.' '.$client->client_postcode.' '.$client->client_city.' '.get_countries($client->client_country);
159
-				}
160
-				else
155
+				} else
161 156
 				{
162 157
 					$address = false;
163 158
 				}
Please login to merge, or discard this patch.
src/Adapter/Qrcode/PhpQrCode.php 1 patch
Braces   +194 added lines, -109 removed lines patch added patch discarded remove patch
@@ -176,8 +176,9 @@  discard block
 block discarded – undo
176 176
 		{
177 177
 			$barcode_array = array();
178 178
             
179
-			if (!is_array($mode))
180
-				$mode = explode(',', $mode);
179
+			if (!is_array($mode)) {
180
+							$mode = explode(',', $mode);
181
+			}
181 182
                 
182 183
 			$eccLevel = 'L';
183 184
                 
@@ -194,8 +195,9 @@  discard block
 block discarded – undo
194 195
                 
195 196
 			foreach ($qrTab as $line) {
196 197
 				$arrAdd = array();
197
-				foreach(str_split($line) as $char)
198
-					$arrAdd[] = ($char=='1')?1:0;
198
+				foreach(str_split($line) as $char) {
199
+									$arrAdd[] = ($char=='1')?1:0;
200
+				}
199 201
 				$barcode_array['bcode'][] = $arrAdd;
200 202
 			}
201 203
                     
@@ -223,8 +225,9 @@  discard block
 block discarded – undo
223 225
 				
224 226
 				$width = count($frame);
225 227
 				$bitMask = array_fill(0, $width, array_fill(0, $width, 0));
226
-				for ($maskNo = 0; $maskNo < 8; $maskNo++)
227
-					$mask->makeMaskNo($maskNo, $width, $frame, $bitMask, true);
228
+				for ($maskNo = 0; $maskNo < 8; $maskNo++) {
229
+									$mask->makeMaskNo($maskNo, $width, $frame, $bitMask, true);
230
+				}
228 231
 			}
229 232
 			
230 233
 			QRtools::markTime('after_build_cache');
@@ -261,8 +264,9 @@  discard block
 block discarded – undo
261 264
 			list($usec, $sec) = explode(" ", microtime());
262 265
 			$time = ((float)$usec + (float)$sec);
263 266
             
264
-			if (!isset($GLOBALS['qr_time_bench']))
265
-				$GLOBALS['qr_time_bench'] = array();
267
+			if (!isset($GLOBALS['qr_time_bench'])) {
268
+							$GLOBALS['qr_time_bench'] = array();
269
+			}
266 270
             
267 271
 			$GLOBALS['qr_time_bench'][$markerId] = $time;
268 272
 		}
@@ -427,8 +431,9 @@  discard block
 block discarded – undo
427 431
 
428 432
 			for($i=1; $i<= QRSPEC_VERSION_MAX; $i++) {
429 433
 				$words  = self::$capacity[$i][QRCAP_WORDS] - self::$capacity[$i][QRCAP_EC][$level];
430
-				if($words >= $size) 
431
-					return $i;
434
+				if($words >= $size) {
435
+									return $i;
436
+				}
432 437
 			}
433 438
 
434 439
 			return -1;
@@ -446,8 +451,9 @@  discard block
 block discarded – undo
446 451
 		//----------------------------------------------------------------------
447 452
 		public static function lengthIndicator($mode, $version)
448 453
 		{
449
-			if ($mode == QR_MODE_STRUCTURE)
450
-				return 0;
454
+			if ($mode == QR_MODE_STRUCTURE) {
455
+							return 0;
456
+			}
451 457
                 
452 458
 			if ($version <= 9) {
453 459
 				$l = 0;
@@ -463,8 +469,9 @@  discard block
 block discarded – undo
463 469
 		//----------------------------------------------------------------------
464 470
 		public static function maximumWords($mode, $version)
465 471
 		{
466
-			if($mode == QR_MODE_STRUCTURE) 
467
-				return 3;
472
+			if($mode == QR_MODE_STRUCTURE) {
473
+							return 3;
474
+			}
468 475
                 
469 476
 			if($version <= 9) {
470 477
 				$l = 0;
@@ -610,8 +617,9 @@  discard block
 block discarded – undo
610 617
 		//----------------------------------------------------------------------
611 618
 		public static function putAlignmentPattern($version, &$frame, $width)
612 619
 		{
613
-			if($version < 2)
614
-				return;
620
+			if($version < 2) {
621
+							return;
622
+			}
615 623
 
616 624
 			$d = self::$alignmentPattern[$version][1] - self::$alignmentPattern[$version][0];
617 625
 			if($d < 0) {
@@ -663,8 +671,9 @@  discard block
 block discarded – undo
663 671
 		//----------------------------------------------------------------------
664 672
 		public static function getVersionPattern($version)
665 673
 		{
666
-			if($version < 7 || $version > QRSPEC_VERSION_MAX)
667
-				return 0;
674
+			if($version < 7 || $version > QRSPEC_VERSION_MAX) {
675
+							return 0;
676
+			}
668 677
 
669 678
 			return self::$versionPattern[$version -7];
670 679
 		}
@@ -681,11 +690,13 @@  discard block
 block discarded – undo
681 690
 
682 691
 		public static function getFormatInfo($mask, $level)
683 692
 		{
684
-			if($mask < 0 || $mask > 7)
685
-				return 0;
693
+			if($mask < 0 || $mask > 7) {
694
+							return 0;
695
+			}
686 696
                 
687
-			if($level < 0 || $level > 3)
688
-				return 0;                
697
+			if($level < 0 || $level > 3) {
698
+							return 0;
699
+			}
689 700
 
690 701
 			return self::$formatInfo[$level][$mask];
691 702
 		}
@@ -865,8 +876,9 @@  discard block
 block discarded – undo
865 876
 		//----------------------------------------------------------------------
866 877
 		public static function newFrame($version)
867 878
 		{
868
-			if($version < 1 || $version > QRSPEC_VERSION_MAX) 
869
-				return null;
879
+			if($version < 1 || $version > QRSPEC_VERSION_MAX) {
880
+							return null;
881
+			}
870 882
 
871 883
 			if(!isset(self::$frames[$version])) {
872 884
                 
@@ -884,8 +896,9 @@  discard block
 block discarded – undo
884 896
 				}
885 897
 			}
886 898
             
887
-			if(is_null(self::$frames[$version]))
888
-				return null;
899
+			if(is_null(self::$frames[$version])) {
900
+							return null;
901
+			}
889 902
 
890 903
 			return self::$frames[$version];
891 904
 		}
@@ -950,7 +963,7 @@  discard block
 block discarded – undo
950 963
 					ImagePng($image, $filename);
951 964
 					header("Content-type: image/png");
952 965
 					ImagePng($image);
953
-				}else{
966
+				} else{
954 967
 					ImagePng($image, $filename);
955 968
 				}
956 969
 			}
@@ -1210,8 +1223,9 @@  discard block
 block discarded – undo
1210 1223
 		{
1211 1224
 			$bits = 0;
1212 1225
 
1213
-			if($version == 0) 
1214
-				$version = 1;
1226
+			if($version == 0) {
1227
+							$version = 1;
1228
+			}
1215 1229
 
1216 1230
 			switch($this->mode) {
1217 1231
 				case QR_MODE_NUM:        $bits = QRinput::estimateBitsModeNum($this->size);    break;
@@ -1270,8 +1284,9 @@  discard block
 block discarded – undo
1270 1284
 							break;
1271 1285
 					}
1272 1286
                     
1273
-					if($ret < 0)
1274
-						return -1;
1287
+					if($ret < 0) {
1288
+											return -1;
1289
+					}
1275 1290
 				}
1276 1291
 
1277 1292
 				return $this->bstream->size();
@@ -1488,8 +1503,9 @@  discard block
 block discarded – undo
1488 1503
 		//----------------------------------------------------------------------
1489 1504
 		public static function checkModeKanji($size, $data)
1490 1505
 		{
1491
-			if($size & 1)
1492
-				return false;
1506
+			if($size & 1) {
1507
+							return false;
1508
+			}
1493 1509
 
1494 1510
 			for($i=0; $i<$size; $i+=2) {
1495 1511
 				$val = (ord($data[$i]) << 8) | ord($data[$i+1]);
@@ -1509,8 +1525,9 @@  discard block
 block discarded – undo
1509 1525
 
1510 1526
 		public static function check($mode, $size, $data)
1511 1527
 		{
1512
-			if($size <= 0) 
1513
-				return false;
1528
+			if($size <= 0) {
1529
+							return false;
1530
+			}
1514 1531
 
1515 1532
 			switch($mode) {
1516 1533
 				case QR_MODE_NUM:       return self::checkModeNum($size, $data);   break;
@@ -1575,8 +1592,9 @@  discard block
 block discarded – undo
1575 1592
 					$chunks = (int)($payload / 11);
1576 1593
 					$remain = $payload - $chunks * 11;
1577 1594
 					$size = $chunks * 2;
1578
-					if($remain >= 6) 
1579
-						$size++;
1595
+					if($remain >= 6) {
1596
+											$size++;
1597
+					}
1580 1598
 					break;
1581 1599
 				case QR_MODE_8:
1582 1600
 					$size = (int)($payload / 8);
@@ -1593,8 +1611,12 @@  discard block
 block discarded – undo
1593 1611
 			}
1594 1612
             
1595 1613
 			$maxsize = QRspec::maximumWords($mode, $version);
1596
-			if($size < 0) $size = 0;
1597
-			if($size > $maxsize) $size = $maxsize;
1614
+			if($size < 0) {
1615
+				$size = 0;
1616
+			}
1617
+			if($size > $maxsize) {
1618
+				$size = $maxsize;
1619
+			}
1598 1620
 
1599 1621
 			return $size;
1600 1622
 		}
@@ -1607,8 +1629,9 @@  discard block
 block discarded – undo
1607 1629
 			foreach($this->items as $item) {
1608 1630
 				$bits = $item->encodeBitStream($this->version);
1609 1631
                 
1610
-				if($bits < 0) 
1611
-					return -1;
1632
+				if($bits < 0) {
1633
+									return -1;
1634
+				}
1612 1635
                     
1613 1636
 				$total += $bits;
1614 1637
 			}
@@ -1627,8 +1650,9 @@  discard block
 block discarded – undo
1627 1650
 			for(;;) {
1628 1651
 				$bits = $this->createBitStream();
1629 1652
                 
1630
-				if($bits < 0) 
1631
-					return -1;
1653
+				if($bits < 0) {
1654
+									return -1;
1655
+				}
1632 1656
                     
1633 1657
 				$ver = QRspec::getMinimumVersion((int)(($bits + 7) / 8), $this->level);
1634 1658
 				if($ver < 0) {
@@ -1665,8 +1689,9 @@  discard block
 block discarded – undo
1665 1689
 			$padding = new QRbitstream();
1666 1690
 			$ret = $padding->appendNum($words * 8 - $bits + 4, 0);
1667 1691
             
1668
-			if($ret < 0) 
1669
-				return $ret;
1692
+			if($ret < 0) {
1693
+							return $ret;
1694
+			}
1670 1695
 
1671 1696
 			$padlen = $maxwords - $words;
1672 1697
             
@@ -1679,8 +1704,9 @@  discard block
 block discarded – undo
1679 1704
                 
1680 1705
 				$ret = $padding->appendBytes($padlen, $padbuf);
1681 1706
                 
1682
-				if($ret < 0)
1683
-					return $ret;
1707
+				if($ret < 0) {
1708
+									return $ret;
1709
+				}
1684 1710
                 
1685 1711
 			}
1686 1712
 
@@ -1857,13 +1883,15 @@  discard block
 block discarded – undo
1857 1883
 		//----------------------------------------------------------------------
1858 1884
 		public function appendNum($bits, $num)
1859 1885
 		{
1860
-			if ($bits == 0) 
1861
-				return 0;
1886
+			if ($bits == 0) {
1887
+							return 0;
1888
+			}
1862 1889
 
1863 1890
 			$b = QRbitstream::newFromNum($bits, $num);
1864 1891
             
1865
-			if(is_null($b))
1866
-				return -1;
1892
+			if(is_null($b)) {
1893
+							return -1;
1894
+			}
1867 1895
 
1868 1896
 			$ret = $this->append($b);
1869 1897
 			unset($b);
@@ -1874,13 +1902,15 @@  discard block
 block discarded – undo
1874 1902
 		//----------------------------------------------------------------------
1875 1903
 		public function appendBytes($size, $data)
1876 1904
 		{
1877
-			if ($size == 0) 
1878
-				return 0;
1905
+			if ($size == 0) {
1906
+							return 0;
1907
+			}
1879 1908
 
1880 1909
 			$b = QRbitstream::newFromBytes($size, $data);
1881 1910
             
1882
-			if(is_null($b))
1883
-				return -1;
1911
+			if(is_null($b)) {
1912
+							return -1;
1913
+			}
1884 1914
 
1885 1915
 			$ret = $this->append($b);
1886 1916
 			unset($b);
@@ -1984,8 +2014,9 @@  discard block
 block discarded – undo
1984 2014
 		//----------------------------------------------------------------------
1985 2015
 		public static function isdigitat($str, $pos)
1986 2016
 		{    
1987
-			if ($pos >= strlen($str))
1988
-				return false;
2017
+			if ($pos >= strlen($str)) {
2018
+							return false;
2019
+			}
1989 2020
             
1990 2021
 			return ((ord($str[$pos]) >= ord('0'))&&(ord($str[$pos]) <= ord('9')));
1991 2022
 		}
@@ -1993,8 +2024,9 @@  discard block
 block discarded – undo
1993 2024
 		//----------------------------------------------------------------------
1994 2025
 		public static function isalnumat($str, $pos)
1995 2026
 		{
1996
-			if ($pos >= strlen($str))
1997
-				return false;
2027
+			if ($pos >= strlen($str)) {
2028
+							return false;
2029
+			}
1998 2030
                 
1999 2031
 			return (QRinput::lookAnTable(ord($str[$pos])) >= 0);
2000 2032
 		}
@@ -2002,8 +2034,9 @@  discard block
 block discarded – undo
2002 2034
 		//----------------------------------------------------------------------
2003 2035
 		public function identifyMode($pos)
2004 2036
 		{
2005
-			if ($pos >= strlen($this->dataStr)) 
2006
-				return QR_MODE_NUL;
2037
+			if ($pos >= strlen($this->dataStr)) {
2038
+							return QR_MODE_NUL;
2039
+			}
2007 2040
                 
2008 2041
 			$c = $this->dataStr[$pos];
2009 2042
             
@@ -2057,8 +2090,9 @@  discard block
 block discarded – undo
2057 2090
 			}
2058 2091
             
2059 2092
 			$ret = $this->input->append(QR_MODE_NUM, $run, str_split($this->dataStr));
2060
-			if($ret < 0)
2061
-				return -1;
2093
+			if($ret < 0) {
2094
+							return -1;
2095
+			}
2062 2096
 
2063 2097
 			return $run;
2064 2098
 		}
@@ -2104,8 +2138,9 @@  discard block
 block discarded – undo
2104 2138
 			}
2105 2139
 
2106 2140
 			$ret = $this->input->append(QR_MODE_AN, $run, str_split($this->dataStr));
2107
-			if($ret < 0)
2108
-				return -1;
2141
+			if($ret < 0) {
2142
+							return -1;
2143
+			}
2109 2144
 
2110 2145
 			return $run;
2111 2146
 		}
@@ -2120,8 +2155,9 @@  discard block
 block discarded – undo
2120 2155
 			}
2121 2156
             
2122 2157
 			$ret = $this->input->append(QR_MODE_KANJI, $p, str_split($this->dataStr));
2123
-			if($ret < 0)
2124
-				return -1;
2158
+			if($ret < 0) {
2159
+							return -1;
2160
+			}
2125 2161
 
2126 2162
 			return $run;
2127 2163
 		}
@@ -2175,8 +2211,9 @@  discard block
 block discarded – undo
2175 2211
 			$run = $p;
2176 2212
 			$ret = $this->input->append(QR_MODE_8, $run, str_split($this->dataStr));
2177 2213
             
2178
-			if($ret < 0)
2179
-				return -1;
2214
+			if($ret < 0) {
2215
+							return -1;
2216
+			}
2180 2217
 
2181 2218
 			return $run;
2182 2219
 		}
@@ -2186,8 +2223,9 @@  discard block
 block discarded – undo
2186 2223
 		{
2187 2224
 			while (strlen($this->dataStr) > 0)
2188 2225
 			{
2189
-				if($this->dataStr == '')
2190
-					return 0;
2226
+				if($this->dataStr == '') {
2227
+									return 0;
2228
+				}
2191 2229
 
2192 2230
 				$mode = $this->identifyMode(0);
2193 2231
                 
@@ -2195,16 +2233,22 @@  discard block
 block discarded – undo
2195 2233
 					case QR_MODE_NUM: $length = $this->eatNum(); break;
2196 2234
 					case QR_MODE_AN:  $length = $this->eatAn(); break;
2197 2235
 					case QR_MODE_KANJI:
2198
-						if ($hint == QR_MODE_KANJI)
2199
-								$length = $this->eatKanji();
2200
-						else    $length = $this->eat8();
2236
+						if ($hint == QR_MODE_KANJI) {
2237
+														$length = $this->eatKanji();
2238
+						} else {
2239
+							$length = $this->eat8();
2240
+						}
2201 2241
 						break;
2202 2242
 					default: $length = $this->eat8(); break;
2203 2243
                 
2204 2244
 				}
2205 2245
 
2206
-				if($length == 0) return 0;
2207
-				if($length < 0)  return -1;
2246
+				if($length == 0) {
2247
+					return 0;
2248
+				}
2249
+				if($length < 0) {
2250
+					return -1;
2251
+				}
2208 2252
                 
2209 2253
 				$this->dataStr = substr($this->dataStr, $length);
2210 2254
 			}
@@ -2240,8 +2284,9 @@  discard block
 block discarded – undo
2240 2284
 
2241 2285
 			$split = new QRsplit($string, $input, $modeHint);
2242 2286
             
2243
-			if(!$casesensitive)
2244
-				$split->toUpper();
2287
+			if(!$casesensitive) {
2288
+							$split->toUpper();
2289
+			}
2245 2290
                 
2246 2291
 			return $split->splitString();
2247 2292
 		}
@@ -2318,11 +2363,23 @@  discard block
 block discarded – undo
2318 2363
 			$rs = null;
2319 2364
             
2320 2365
 			// Check parameter ranges
2321
-			if($symsize < 0 || $symsize > 8)                     return $rs;
2322
-			if($fcr < 0 || $fcr >= (1<<$symsize))                return $rs;
2323
-			if($prim <= 0 || $prim >= (1<<$symsize))             return $rs;
2324
-			if($nroots < 0 || $nroots >= (1<<$symsize))          return $rs; // Can't have more roots than symbol values!
2325
-			if($pad < 0 || $pad >= ((1<<$symsize) -1 - $nroots)) return $rs; // Too much padding
2366
+			if($symsize < 0 || $symsize > 8) {
2367
+				return $rs;
2368
+			}
2369
+			if($fcr < 0 || $fcr >= (1<<$symsize)) {
2370
+				return $rs;
2371
+			}
2372
+			if($prim <= 0 || $prim >= (1<<$symsize)) {
2373
+				return $rs;
2374
+			}
2375
+			if($nroots < 0 || $nroots >= (1<<$symsize)) {
2376
+				return $rs;
2377
+			}
2378
+			// Can't have more roots than symbol values!
2379
+			if($pad < 0 || $pad >= ((1<<$symsize) -1 - $nroots)) {
2380
+				return $rs;
2381
+			}
2382
+			// Too much padding
2326 2383
 
2327 2384
 			$rs = new QRrsItem();
2328 2385
 			$rs->mm = $symsize;
@@ -2388,8 +2445,9 @@  discard block
 block discarded – undo
2388 2445
 			}
2389 2446
             
2390 2447
 			// convert rs->genpoly[] to index form for quicker encoding
2391
-			for ($i = 0; $i <= $nroots; $i++)
2392
-				$rs->genpoly[$i] = $rs->index_of[$rs->genpoly[$i]];
2448
+			for ($i = 0; $i <= $nroots; $i++) {
2449
+							$rs->genpoly[$i] = $rs->index_of[$rs->genpoly[$i]];
2450
+			}
2393 2451
 
2394 2452
 			return $rs;
2395 2453
 		}
@@ -2447,12 +2505,24 @@  discard block
 block discarded – undo
2447 2505
 		public static function init_rs($symsize, $gfpoly, $fcr, $prim, $nroots, $pad)
2448 2506
 		{
2449 2507
 			foreach(self::$items as $rs) {
2450
-				if($rs->pad != $pad)       continue;
2451
-				if($rs->nroots != $nroots) continue;
2452
-				if($rs->mm != $symsize)    continue;
2453
-				if($rs->gfpoly != $gfpoly) continue;
2454
-				if($rs->fcr != $fcr)       continue;
2455
-				if($rs->prim != $prim)     continue;
2508
+				if($rs->pad != $pad) {
2509
+					continue;
2510
+				}
2511
+				if($rs->nroots != $nroots) {
2512
+					continue;
2513
+				}
2514
+				if($rs->mm != $symsize) {
2515
+					continue;
2516
+				}
2517
+				if($rs->gfpoly != $gfpoly) {
2518
+					continue;
2519
+				}
2520
+				if($rs->fcr != $fcr) {
2521
+					continue;
2522
+				}
2523
+				if($rs->prim != $prim) {
2524
+					continue;
2525
+				}
2456 2526
 
2457 2527
 				return $rs;
2458 2528
 			}
@@ -2591,8 +2661,9 @@  discard block
 block discarded – undo
2591 2661
 		{
2592 2662
 			$codeArr = array();
2593 2663
             
2594
-			foreach ($bitFrame as $line)
2595
-				$codeArr[] = join('', $line);
2664
+			foreach ($bitFrame as $line) {
2665
+							$codeArr[] = join('', $line);
2666
+			}
2596 2667
                 
2597 2668
 			return gzcompress(join("\n", $codeArr), 9);
2598 2669
 		}
@@ -2603,8 +2674,9 @@  discard block
 block discarded – undo
2603 2674
 			$codeArr = array();
2604 2675
             
2605 2676
 			$codeLines = explode("\n", gzuncompress($code));
2606
-			foreach ($codeLines as $line)
2607
-				$codeArr[] = str_split($line);
2677
+			foreach ($codeLines as $line) {
2678
+							$codeArr[] = str_split($line);
2679
+			}
2608 2680
             
2609 2681
 			return $codeArr;
2610 2682
 		}
@@ -2622,16 +2694,18 @@  discard block
 block discarded – undo
2622 2694
 					$bitMask = self::unserial(file_get_contents($fileName));
2623 2695
 				} else {
2624 2696
 					$bitMask = $this->generateMaskNo($maskNo, $width, $s, $d);
2625
-					if (!file_exists(QR_CACHE_DIR.'mask_'.$maskNo))
2626
-						mkdir(QR_CACHE_DIR.'mask_'.$maskNo);
2697
+					if (!file_exists(QR_CACHE_DIR.'mask_'.$maskNo)) {
2698
+											mkdir(QR_CACHE_DIR.'mask_'.$maskNo);
2699
+					}
2627 2700
 					file_put_contents($fileName, self::serial($bitMask));
2628 2701
 				}
2629 2702
 			} else {
2630 2703
 				$bitMask = $this->generateMaskNo($maskNo, $width, $s, $d);
2631 2704
 			}
2632 2705
 
2633
-			if ($maskGenOnly)
2634
-				return;
2706
+			if ($maskGenOnly) {
2707
+							return;
2708
+			}
2635 2709
                 
2636 2710
 			$d = $s;
2637 2711
 
@@ -2698,8 +2772,9 @@  discard block
 block discarded – undo
2698 2772
                 
2699 2773
 				$frameY = $frame[$y];
2700 2774
                 
2701
-				if ($y>0)
2702
-					$frameYM = $frame[$y-1];
2775
+				if ($y>0) {
2776
+									$frameYM = $frame[$y-1];
2777
+				}
2703 2778
                 
2704 2779
 				for($x=0; $x<$width; $x++) {
2705 2780
 					if(($x > 0) && ($y > 0)) {
@@ -2912,14 +2987,17 @@  discard block
 block discarded – undo
2912 2987
 				$blockNo++;
2913 2988
 			}
2914 2989
 
2915
-			if(QRspec::rsBlockNum2($spec) == 0)
2916
-				return 0;
2990
+			if(QRspec::rsBlockNum2($spec) == 0) {
2991
+							return 0;
2992
+			}
2917 2993
 
2918 2994
 			$dl = QRspec::rsDataCodes2($spec);
2919 2995
 			$el = QRspec::rsEccCodes2($spec);
2920 2996
 			$rs = QRrs::init_rs(8, 0x11d, 0, 1, $el, 255 - $dl - $el);
2921 2997
             
2922
-			if($rs == NULL) return -1;
2998
+			if($rs == NULL) {
2999
+				return -1;
3000
+			}
2923 3001
             
2924 3002
 			for($i=0; $i<QRspec::rsBlockNum2($spec); $i++) {
2925 3003
 				$ecc = array_slice($this->ecccode,$eccPos);
@@ -3057,7 +3135,9 @@  discard block
 block discarded – undo
3057 3135
 			}
3058 3136
 
3059 3137
 			$input = new QRinput($version, $level);
3060
-			if($input == NULL) return NULL;
3138
+			if($input == NULL) {
3139
+				return NULL;
3140
+			}
3061 3141
 
3062 3142
 			$ret = $input->append($input, QR_MODE_8, strlen($string), str_split($string));
3063 3143
 			if($ret < 0) {
@@ -3077,7 +3157,9 @@  discard block
 block discarded – undo
3077 3157
 			}
3078 3158
 
3079 3159
 			$input = new QRinput($version, $level);
3080
-			if($input == NULL) return NULL;
3160
+			if($input == NULL) {
3161
+				return NULL;
3162
+			}
3081 3163
 
3082 3164
 			$ret = QRsplit::splitStringToQRinput($string, $input, $hint, $casesensitive);
3083 3165
 			if($ret < 0) {
@@ -3187,7 +3269,9 @@  discard block
 block discarded – undo
3187 3269
 						}
3188 3270
 					}
3189 3271
 				}
3190
-				if($x < 0 || $y < 0) return null;
3272
+				if($x < 0 || $y < 0) {
3273
+					return null;
3274
+				}
3191 3275
 
3192 3276
 				$this->x = $x;
3193 3277
 				$this->y = $y;
@@ -3294,8 +3378,9 @@  discard block
 block discarded – undo
3294 3378
 				$err = ob_get_contents();
3295 3379
 				ob_end_clean();
3296 3380
                 
3297
-				if ($err != '')
3298
-					QRtools::log($outfile, $err);
3381
+				if ($err != '') {
3382
+									QRtools::log($outfile, $err);
3383
+				}
3299 3384
                 
3300 3385
 				$maxSize = (int)(QR_PNG_MAXIMUM_SIZE / (count($tab)+2*$this->margin));
3301 3386
                 
Please login to merge, or discard this patch.