Completed
Push — master ( e59875...9a94f8 )
by Kenji
18s queued 14s
created
application/tests/_ci_phpunit_test/replacing/core/Input.php 1 patch
Braces   +18 added lines, -27 removed lines patch added patch discarded remove patch
@@ -201,29 +201,30 @@  discard block
 block discarded – undo
201 201
 		if (isset($array[$index]))
202 202
 		{
203 203
 			$value = $array[$index];
204
-		}
205
-		elseif (($count = preg_match_all('/(?:^[^\[]+)|\[[^]]*\]/', $index, $matches)) > 1) // Does the index contain array notation
204
+		} elseif (($count = preg_match_all('/(?:^[^\[]+)|\[[^]]*\]/', $index, $matches)) > 1) {
205
+			// Does the index contain array notation
206 206
 		{
207 207
 			$value = $array;
208
+		}
208 209
 			for ($i = 0; $i < $count; $i++)
209 210
 			{
210 211
 				$key = trim($matches[0][$i], '[]');
211
-				if ($key === '') // Empty notation will return the value as array
212
+				if ($key === '') {
213
+					// Empty notation will return the value as array
212 214
 				{
213 215
 					break;
214 216
 				}
217
+				}
215 218
 
216 219
 				if (isset($value[$key]))
217 220
 				{
218 221
 					$value = $value[$key];
219
-				}
220
-				else
222
+				} else
221 223
 				{
222 224
 					return NULL;
223 225
 				}
224 226
 			}
225
-		}
226
-		else
227
+		} else
227 228
 		{
228 229
 			return NULL;
229 230
 		}
@@ -421,8 +422,7 @@  discard block
 block discarded – undo
421 422
 		if ( ! is_numeric($expire))
422 423
 		{
423 424
 			$expire = time() - 86500;
424
-		}
425
-		else
425
+		} else
426 426
 		{
427 427
 			$expire = ($expire > 0) ? time() + $expire : 0;
428 428
 		}
@@ -432,8 +432,7 @@  discard block
 block discarded – undo
432 432
 		{
433 433
 			$samesite = ucfirst(strtolower($samesite));
434 434
 			in_array($samesite, array('Lax', 'Strict', 'None'), TRUE) OR $samesite = 'Lax';
435
-		}
436
-		else
435
+		} else
437 436
 		{
438 437
 			$samesite = 'Lax';
439 438
 		}
@@ -524,8 +523,7 @@  discard block
 block discarded – undo
524 523
 					if ( ! $this->valid_ip($spoof))
525 524
 					{
526 525
 						$spoof = NULL;
527
-					}
528
-					else
526
+					} else
529 527
 					{
530 528
 						break;
531 529
 					}
@@ -578,8 +576,7 @@  discard block
 block discarded – undo
578 576
 							}
579 577
 
580 578
 							$sprintf = '%016b%016b%016b%016b%016b%016b%016b%016b';
581
-						}
582
-						else
579
+						} else
583 580
 						{
584 581
 							$ip = explode('.', $this->ip_address);
585 582
 							$sprintf = '%08b%08b%08b%08b';
@@ -599,8 +596,7 @@  discard block
 block discarded – undo
599 596
 						{
600 597
 							$netaddr[$j] = intval($netaddr[$j], 16);
601 598
 						}
602
-					}
603
-					else
599
+					} else
604 600
 					{
605 601
 						$netaddr = explode('.', $netaddr);
606 602
 					}
@@ -687,8 +683,7 @@  discard block
 block discarded – undo
687 683
 		if ($this->_allow_get_array === FALSE)
688 684
 		{
689 685
 			$_GET = array();
690
-		}
691
-		elseif (is_array($_GET))
686
+		} elseif (is_array($_GET))
692 687
 		{
693 688
 			foreach ($_GET as $key => $val)
694 689
 			{
@@ -724,8 +719,7 @@  discard block
 block discarded – undo
724 719
 				if (($cookie_key = $this->_clean_input_keys($key)) !== FALSE)
725 720
 				{
726 721
 					$_COOKIE[$cookie_key] = $this->_clean_input_data($val);
727
-				}
728
-				else
722
+				} else
729 723
 				{
730 724
 					unset($_COOKIE[$key]);
731 725
 				}
@@ -815,8 +809,7 @@  discard block
 block discarded – undo
815 809
 			if ($fatal === TRUE)
816 810
 			{
817 811
 				return FALSE;
818
-			}
819
-			else
812
+			} else
820 813
 			{
821 814
 				set_status_header(503);
822 815
 				echo 'Disallowed Key Characters.';
@@ -855,8 +848,7 @@  discard block
 block discarded – undo
855 848
 		if (function_exists('apache_request_headers'))
856 849
 		{
857 850
 			$this->headers = apache_request_headers();
858
-		}
859
-		else
851
+		} else
860 852
 		{
861 853
 			isset($_SERVER['CONTENT_TYPE']) && $this->headers['Content-Type'] = $_SERVER['CONTENT_TYPE'];
862 854
 
@@ -985,8 +977,7 @@  discard block
 block discarded – undo
985 977
 		{
986 978
 			isset($this->_raw_input_stream) OR $this->_raw_input_stream = file_get_contents('php://input');
987 979
 			return $this->_raw_input_stream;
988
-		}
989
-		elseif ($name === 'ip_address')
980
+		} elseif ($name === 'ip_address')
990 981
 		{
991 982
 			return $this->ip_address;
992 983
 		}
Please login to merge, or discard this patch.
application/tests/_ci_phpunit_test/replacing/core/Output.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 	 *
78 78
 	 * @var	array
79 79
 	 */
80
-	public $mimes =	array();
80
+	public $mimes = array();
81 81
 
82 82
 	/**
83 83
 	 * Mime-type for the current page
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	 *
113 113
 	 * @var	array
114 114
 	 */
115
-	protected $_profiler_sections =	array();
115
+	protected $_profiler_sections = array();
116 116
 
117 117
 	/**
118 118
 	 * Parse markers flag
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 		isset(self::$func_overload) OR self::$func_overload = ( ! is_php('8.0') && extension_loaded('mbstring') && @ini_get('mbstring.func_overload'));
168 168
 
169 169
 		// Get mime types for later
170
-		$this->mimes =& get_mimes();
170
+		$this->mimes = & get_mimes();
171 171
 
172 172
 		log_message('info', 'Output Class Initialized');
173 173
 	}
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 			// Is this extension supported?
266 266
 			if (isset($this->mimes[$extension]))
267 267
 			{
268
-				$mime_type =& $this->mimes[$extension];
268
+				$mime_type = & $this->mimes[$extension];
269 269
 
270 270
 				if (is_array($mime_type))
271 271
 				{
@@ -335,7 +335,7 @@  discard block
 block discarded – undo
335 335
 		{
336 336
 			if (strncasecmp($header, $headers[$c], $l = self::strlen($header)) === 0)
337 337
 			{
338
-				return trim(self::substr($headers[$c], $l+1));
338
+				return trim(self::substr($headers[$c], $l + 1));
339 339
 			}
340 340
 		}
341 341
 
@@ -438,13 +438,13 @@  discard block
 block discarded – undo
438 438
 		// Note:  We use load_class() because we can't use $CI =& get_instance()
439 439
 		// since this function is sometimes called by the caching mechanism,
440 440
 		// which happens before the CI super object is available.
441
-		$BM =& load_class('Benchmark', 'core');
442
-		$CFG =& load_class('Config', 'core');
441
+		$BM = & load_class('Benchmark', 'core');
442
+		$CFG = & load_class('Config', 'core');
443 443
 
444 444
 		// Grab the super object if we can.
445 445
 		if (class_exists('CI_Controller', FALSE))
446 446
 		{
447
-			$CI =& get_instance();
447
+			$CI = & get_instance();
448 448
 		}
449 449
 
450 450
 		// --------------------------------------------------------------------
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 		// Set the output data
453 453
 		if ($output === '')
454 454
 		{
455
-			$output =& $this->final_output;
455
+			$output = & $this->final_output;
456 456
 		}
457 457
 
458 458
 		// --------------------------------------------------------------------
@@ -573,7 +573,7 @@  discard block
 block discarded – undo
573 573
 	 */
574 574
 	public function _write_cache($output)
575 575
 	{
576
-		$CI =& get_instance();
576
+		$CI = & get_instance();
577 577
 		$path = $CI->config->item('cache_path');
578 578
 		$cache_path = ($path === '') ? APPPATH.'cache/' : $path;
579 579
 
@@ -752,7 +752,7 @@  discard block
 block discarded – undo
752 752
 	 */
753 753
 	public function delete_cache($uri = '')
754 754
 	{
755
-		$CI =& get_instance();
755
+		$CI = & get_instance();
756 756
 		$cache_path = $CI->config->item('cache_path');
757 757
 		if ($cache_path === '')
758 758
 		{
Please login to merge, or discard this patch.
application/tests/_ci_phpunit_test/replacing/libraries/Upload.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -296,8 +296,8 @@  discard block
 block discarded – undo
296 296
 	{
297 297
 		empty($config) OR $this->initialize($config, FALSE);
298 298
 
299
-		$this->_mimes =& get_mimes();
300
-		$this->_CI =& get_instance();
299
+		$this->_mimes = & get_mimes();
300
+		$this->_CI = & get_instance();
301 301
 
302 302
 		log_message('info', 'Upload Class Initialized');
303 303
 	}
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
 			else
488 488
 			{
489 489
 				// An extension was provided, let's have it!
490
-				$this->file_ext	= $this->get_extension($this->_file_name_override);
490
+				$this->file_ext = $this->get_extension($this->_file_name_override);
491 491
 			}
492 492
 
493 493
 			if ( ! $this->is_allowed_filetype(TRUE))
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
 		// Convert the file size to kilobytes
501 501
 		if ($this->file_size > 0)
502 502
 		{
503
-			$this->file_size = round($this->file_size/1024, 2);
503
+			$this->file_size = round($this->file_size / 1024, 2);
504 504
 		}
505 505
 
506 506
 		// Is the file size within the allowed maximum?
@@ -833,10 +833,10 @@  discard block
 block discarded – undo
833 833
 			{
834 834
 				$types = array(1 => 'gif', 2 => 'jpeg', 3 => 'png');
835 835
 
836
-				$this->image_width	= $D[0];
837
-				$this->image_height	= $D[1];
838
-				$this->image_type	= isset($types[$D[2]]) ? $types[$D[2]] : 'unknown';
839
-				$this->image_size_str	= $D[3]; // string containing height and width
836
+				$this->image_width = $D[0];
837
+				$this->image_height = $D[1];
838
+				$this->image_type = isset($types[$D[2]]) ? $types[$D[2]] : 'unknown';
839
+				$this->image_size_str = $D[3]; // string containing height and width
840 840
 			}
841 841
 		}
842 842
 
@@ -888,7 +888,7 @@  discard block
 block discarded – undo
888 888
 			$this->file_type = 'image/jpeg';
889 889
 		}
890 890
 
891
-		$img_mimes = array('image/gif',	'image/jpeg', 'image/png', 'image/webp');
891
+		$img_mimes = array('image/gif', 'image/jpeg', 'image/png', 'image/webp');
892 892
 
893 893
 		return in_array($this->file_type, $img_mimes, TRUE);
894 894
 	}
@@ -1038,7 +1038,7 @@  discard block
 block discarded – undo
1038 1038
 			return FALSE;
1039 1039
 		}
1040 1040
 
1041
-		$this->upload_path = preg_replace('/(.+?)\/*$/', '\\1/',  $this->upload_path);
1041
+		$this->upload_path = preg_replace('/(.+?)\/*$/', '\\1/', $this->upload_path);
1042 1042
 		return TRUE;
1043 1043
 	}
1044 1044
 
@@ -1086,9 +1086,9 @@  discard block
 block discarded – undo
1086 1086
 		$ext = '';
1087 1087
 		if (strpos($filename, '.') !== FALSE)
1088 1088
 		{
1089
-			$parts		= explode('.', $filename);
1090
-			$ext		= '.'.array_pop($parts);
1091
-			$filename	= implode('.', $parts);
1089
+			$parts = explode('.', $filename);
1090
+			$ext = '.'.array_pop($parts);
1091
+			$filename = implode('.', $parts);
1092 1092
 		}
1093 1093
 
1094 1094
 		return substr($filename, 0, ($length - strlen($ext))).$ext;
Please login to merge, or discard this patch.
Braces   +20 added lines, -17 removed lines patch added patch discarded remove patch
@@ -332,19 +332,16 @@  discard block
 block discarded – undo
332 332
 					if ($reflection->hasMethod('set_'.$key))
333 333
 					{
334 334
 						$this->{'set_'.$key}($config[$key]);
335
-					}
336
-					else
335
+					} else
337 336
 					{
338 337
 						$this->$key = $config[$key];
339 338
 					}
340
-				}
341
-				else
339
+				} else
342 340
 				{
343 341
 					$this->$key = $defaults[$key];
344 342
 				}
345 343
 			}
346
-		}
347
-		else
344
+		} else
348 345
 		{
349 346
 			foreach ($config as $key => &$value)
350 347
 			{
@@ -353,8 +350,7 @@  discard block
 block discarded – undo
353 350
 					if ($reflection->hasMethod('set_'.$key))
354 351
 					{
355 352
 						$this->{'set_'.$key}($value);
356
-					}
357
-					else
353
+					} else
358 354
 					{
359 355
 						$this->$key = $value;
360 356
 					}
@@ -416,9 +412,11 @@  discard block
 block discarded – undo
416 412
 		}
417 413
 
418 414
 		// Was the file able to be uploaded? If not, determine the reason why.
419
-		if ( ! file_exists($_file['tmp_name']))	// modified by ci-phpunit-test
415
+		if ( ! file_exists($_file['tmp_name'])) {
416
+			// modified by ci-phpunit-test
420 417
 		{
421 418
 			$error = isset($_file['error']) ? $_file['error'] : 4;
419
+		}
422 420
 
423 421
 			switch ($error)
424 422
 			{
@@ -483,8 +481,7 @@  discard block
 block discarded – undo
483 481
 			if (strpos($this->_file_name_override, '.') === FALSE)
484 482
 			{
485 483
 				$this->file_name .= $this->file_ext;
486
-			}
487
-			else
484
+			} else
488 485
 			{
489 486
 				// An extension was provided, let's have it!
490 487
 				$this->file_ext	= $this->get_extension($this->_file_name_override);
@@ -882,8 +879,7 @@  discard block
 block discarded – undo
882 879
 		if (in_array($this->file_type, $png_mimes))
883 880
 		{
884 881
 			$this->file_type = 'image/png';
885
-		}
886
-		elseif (in_array($this->file_type, $jpeg_mimes))
882
+		} elseif (in_array($this->file_type, $jpeg_mimes))
887 883
 		{
888 884
 			$this->file_type = 'image/jpeg';
889 885
 		}
@@ -1149,9 +1145,12 @@  discard block
 block discarded – undo
1149 1145
 
1150 1146
 		if (function_exists('getimagesize') && @getimagesize($file) !== FALSE)
1151 1147
 		{
1152
-			if (($file = @fopen($file, 'rb')) === FALSE) // "b" to force binary
1148
+			if (($file = @fopen($file, 'rb')) === FALSE) {
1149
+				// "b" to force binary
1153 1150
 			{
1154
-				return FALSE; // Couldn't open the file, return FALSE
1151
+				return FALSE;
1152
+			}
1153
+			// Couldn't open the file, return FALSE
1155 1154
 			}
1156 1155
 
1157 1156
 			$opening_bytes = fread($file, 256);
@@ -1270,9 +1269,11 @@  discard block
 block discarded – undo
1270 1269
 		if (function_exists('finfo_file'))
1271 1270
 		{
1272 1271
 			$finfo = @finfo_open(FILEINFO_MIME);
1273
-			if ($finfo !== FALSE) // It is possible that a FALSE value is returned, if there is no magic MIME database file found on the system
1272
+			if ($finfo !== FALSE) {
1273
+				// It is possible that a FALSE value is returned, if there is no magic MIME database file found on the system
1274 1274
 			{
1275 1275
 				$mime = @finfo_file($finfo, $file['tmp_name']);
1276
+			}
1276 1277
 				finfo_close($finfo);
1277 1278
 
1278 1279
 				/* According to the comments section of the PHP manual page,
@@ -1357,10 +1358,12 @@  discard block
 block discarded – undo
1357 1358
 		if (function_exists('mime_content_type'))
1358 1359
 		{
1359 1360
 			$this->file_type = @mime_content_type($file['tmp_name']);
1360
-			if (strlen($this->file_type) > 0) // It's possible that mime_content_type() returns FALSE or an empty string
1361
+			if (strlen($this->file_type) > 0) {
1362
+				// It's possible that mime_content_type() returns FALSE or an empty string
1361 1363
 			{
1362 1364
 				return;
1363 1365
 			}
1366
+			}
1364 1367
 		}
1365 1368
 
1366 1369
 		$this->file_type = $file['type'];
Please login to merge, or discard this patch.