Completed
Pull Request — master (#157)
by Kenji
02:07
created
application/tests/_ci_phpunit_test/CIPHPUnitTestSuperGlobal.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
 		}
43 43
 
44 44
 		// Handle single file
45
-		$file =& $files[$field];
45
+		$file = & $files[$field];
46 46
 
47
-		if (! file_exists($file['tmp_name']))
47
+		if ( ! file_exists($file['tmp_name']))
48 48
 		{
49 49
 			$file['error'] = UPLOAD_ERR_NO_FILE;
50 50
 			$file['type'] = '';
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 				// Set $_GET if URI string has query string
111 111
 				parse_str($query_string, $_GET);
112 112
 				// Remove query string from URI string
113
-				$argv = substr($argv, 0, -strlen($query_string)-1);
113
+				$argv = substr($argv, 0, -strlen($query_string) - 1);
114 114
 			}
115 115
 		}
116 116
 
@@ -143,12 +143,12 @@  discard block
 block discarded – undo
143 143
 		if ($_GET !== [])
144 144
 		{
145 145
 			$_SERVER['REQUEST_URI'] =
146
-				'/' . $path . '?'
146
+				'/'.$path.'?'
147 147
 				. http_build_query($_GET);
148 148
 		}
149 149
 		else
150 150
 		{
151
-			$_SERVER['REQUEST_URI'] = '/' . $path;
151
+			$_SERVER['REQUEST_URI'] = '/'.$path;
152 152
 		}
153 153
 	}
154 154
 
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 
166 166
 		if ($query_string === false)
167 167
 		{
168
-			throw new LogicException('Bad URI string: ' . $uri);
168
+			throw new LogicException('Bad URI string: '.$uri);
169 169
 		}
170 170
 
171 171
 		return $query_string;
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
 		}
191 191
 		else
192 192
 		{
193
-			$key = 'HTTP_' . $normalized_name;
193
+			$key = 'HTTP_'.$normalized_name;
194 194
 		}
195 195
 
196 196
 		$_SERVER[$key] = $value;
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -76,8 +76,7 @@  discard block
 block discarded – undo
76 76
 		if (is_numeric($value))
77 77
 		{
78 78
 			return $value;
79
-		}
80
-		else
79
+		} else
81 80
 		{
82 81
 			$value_length = strlen($value);
83 82
 			$number = substr($value, 0, $value_length - 1);
@@ -133,8 +132,7 @@  discard block
 block discarded – undo
133 132
 		if (is_string($argv))
134 133
 		{
135 134
 			$path = $argv;
136
-		}
137
-		elseif (is_array($argv))
135
+		} elseif (is_array($argv))
138 136
 		{
139 137
 			// Generate URI path from array of controller, method, arg, ...
140 138
 			$path = implode('/', $argv);
@@ -145,8 +143,7 @@  discard block
 block discarded – undo
145 143
 			$_SERVER['REQUEST_URI'] =
146 144
 				'/' . $path . '?'
147 145
 				. http_build_query($_GET);
148
-		}
149
-		else
146
+		} else
150 147
 		{
151 148
 			$_SERVER['REQUEST_URI'] = '/' . $path;
152 149
 		}
@@ -187,8 +184,7 @@  discard block
 block discarded – undo
187 184
 		)
188 185
 		{
189 186
 			$key = $normalized_name;
190
-		}
191
-		else
187
+		} else
192 188
 		{
193 189
 			$key = 'HTTP_' . $normalized_name;
194 190
 		}
Please login to merge, or discard this patch.
application/tests/_ci_phpunit_test/replacing/core/Loader.php 1 patch
Braces   +17 added lines, -34 removed lines patch added patch discarded remove patch
@@ -192,16 +192,14 @@  discard block
 block discarded – undo
192 192
 		if (empty($library))
193 193
 		{
194 194
 			return $this;
195
-		}
196
-		elseif (is_array($library))
195
+		} elseif (is_array($library))
197 196
 		{
198 197
 			foreach ($library as $key => $value)
199 198
 			{
200 199
 				if (is_int($key))
201 200
 				{
202 201
 					$this->library($value, $params);
203
-				}
204
-				else
202
+				} else
205 203
 				{
206 204
 					$this->library($key, $params, $value);
207 205
 				}
@@ -238,8 +236,7 @@  discard block
 block discarded – undo
238 236
 		if (empty($model))
239 237
 		{
240 238
 			return $this;
241
-		}
242
-		elseif (is_array($model))
239
+		} elseif (is_array($model))
243 240
 		{
244 241
 			foreach ($model as $key => $value)
245 242
 			{
@@ -305,8 +302,7 @@  discard block
 block discarded – undo
305 302
 				{
306 303
 					throw new RuntimeException($app_path."Model.php exists, but doesn't declare class CI_Model");
307 304
 				}
308
-			}
309
-			elseif ( ! class_exists('CI_Model', FALSE))
305
+			} elseif ( ! class_exists('CI_Model', FALSE))
310 306
 			{
311 307
 				require_once(BASEPATH.'core'.DIRECTORY_SEPARATOR.'Model.php');
312 308
 			}
@@ -457,8 +453,7 @@  discard block
 block discarded – undo
457 453
 				require_once($driver_path);
458 454
 				$class = 'CI_DB_'.$db->dbdriver.'_'.$db->subdriver.'_forge';
459 455
 			}
460
-		}
461
-		else
456
+		} else
462 457
 		{
463 458
 			$class = 'CI_DB_'.$db->dbdriver.'_forge';
464 459
 		}
@@ -725,16 +720,14 @@  discard block
 block discarded – undo
725 720
 				if (is_int($key))
726 721
 				{
727 722
 					$this->driver($value, $params);
728
-				}
729
-				else
723
+				} else
730 724
 				{
731 725
 					$this->driver($key, $params, $value);
732 726
 				}
733 727
 			}
734 728
 
735 729
 			return $this;
736
-		}
737
-		elseif (empty($library))
730
+		} elseif (empty($library))
738 731
 		{
739 732
 			return FALSE;
740 733
 		}
@@ -827,8 +820,7 @@  discard block
 block discarded – undo
827 820
 			array_shift($this->_ci_helper_paths);
828 821
 			array_shift($this->_ci_view_paths);
829 822
 			array_pop($config->_config_paths);
830
-		}
831
-		else
823
+		} else
832 824
 		{
833 825
 			$path = rtrim($path, '/').'/';
834 826
 			foreach (array('_ci_library_paths', '_ci_model_paths', '_ci_helper_paths') as $var)
@@ -890,8 +882,7 @@  discard block
 block discarded – undo
890 882
 		{
891 883
 			$_ci_x = explode('/', $_ci_path);
892 884
 			$_ci_file = end($_ci_x);
893
-		}
894
-		else
885
+		} else
895 886
 		{
896 887
 			$_ci_ext = pathinfo($_ci_view, PATHINFO_EXTENSION);
897 888
 			$_ci_file = ($_ci_ext === '') ? $_ci_view.'.php' : $_ci_view;
@@ -969,8 +960,7 @@  discard block
 block discarded – undo
969 960
 		if ( ! is_php('5.4') && ! ini_get('short_open_tag') && config_item('rewrite_short_tags') === TRUE)
970 961
 		{
971 962
 			echo eval('?>'.preg_replace('/;*\s*\?>/', '; ?>', str_replace('<?=', '<?php echo ', file_get_contents($_ci_path))));
972
-		}
973
-		else
963
+		} else
974 964
 		{
975 965
 			include($_ci_path); // include() vs include_once() allows for multiple views with the same name
976 966
 		}
@@ -997,8 +987,7 @@  discard block
 block discarded – undo
997 987
 		if (ob_get_level() > $this->_ci_ob_level + 1)
998 988
 		{
999 989
 			ob_end_flush();
1000
-		}
1001
-		else
990
+		} else
1002 991
 		{
1003 992
 			$_ci_CI->output->append_output(ob_get_contents());
1004 993
 			@ob_end_clean();
@@ -1038,8 +1027,7 @@  discard block
 block discarded – undo
1038 1027
 
1039 1028
 			// Get the filename from the path
1040 1029
 			$class = substr($class, $last_slash);
1041
-		}
1042
-		else
1030
+		} else
1043 1031
 		{
1044 1032
 			$subdir = '';
1045 1033
 		}
@@ -1177,8 +1165,7 @@  discard block
 block discarded – undo
1177 1165
 		if (file_exists(APPPATH.'tests/_ci_phpunit_test/replacing/libraries/'.$file_path.$library_name.'.php'))
1178 1166
 		{
1179 1167
 			include_once(APPPATH.'tests/_ci_phpunit_test/replacing/libraries/'.$file_path.$library_name.'.php');
1180
-		}
1181
-		else
1168
+		} else
1182 1169
 		{
1183 1170
 			include_once(BASEPATH.'libraries/'.$file_path.$library_name.'.php');
1184 1171
 		}
@@ -1194,8 +1181,7 @@  discard block
 block discarded – undo
1194 1181
 				{
1195 1182
 					$prefix = config_item('subclass_prefix');
1196 1183
 					break;
1197
-				}
1198
-				else
1184
+				} else
1199 1185
 				{
1200 1186
 					log_message('debug', $path.' exists, but does not declare '.$subclass);
1201 1187
 				}
@@ -1242,8 +1228,7 @@  discard block
 block discarded – undo
1242 1228
 					{
1243 1229
 						include($path.'config/'.strtolower($class).'.php');
1244 1230
 						$found = TRUE;
1245
-					}
1246
-					elseif (file_exists($path.'config/'.ucfirst(strtolower($class)).'.php'))
1231
+					} elseif (file_exists($path.'config/'.ucfirst(strtolower($class)).'.php'))
1247 1232
 					{
1248 1233
 						include($path.'config/'.ucfirst(strtolower($class)).'.php');
1249 1234
 						$found = TRUE;
@@ -1253,8 +1238,7 @@  discard block
 block discarded – undo
1253 1238
 					{
1254 1239
 						include($path.'config/'.ENVIRONMENT.'/'.strtolower($class).'.php');
1255 1240
 						$found = TRUE;
1256
-					}
1257
-					elseif (file_exists($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php'))
1241
+					} elseif (file_exists($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php'))
1258 1242
 					{
1259 1243
 						include($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php');
1260 1244
 						$found = TRUE;
@@ -1442,8 +1426,7 @@  discard block
 block discarded – undo
1442 1426
 		if ( ! is_array($filename))
1443 1427
 		{
1444 1428
 			return array(strtolower(str_replace(array($extension, '.php'), '', $filename).$extension));
1445
-		}
1446
-		else
1429
+		} else
1447 1430
 		{
1448 1431
 			foreach ($filename as $key => $val)
1449 1432
 			{
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
@@ -293,8 +293,8 @@  discard block
 block discarded – undo
293 293
 	{
294 294
 		empty($config) OR $this->initialize($config, FALSE);
295 295
 
296
-		$this->_mimes =& get_mimes();
297
-		$this->_CI =& get_instance();
296
+		$this->_mimes = & get_mimes();
297
+		$this->_CI = & get_instance();
298 298
 
299 299
 		log_message('info', 'Upload Class Initialized');
300 300
 	}
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
 			else
481 481
 			{
482 482
 				// An extension was provided, let's have it!
483
-				$this->file_ext	= $this->get_extension($this->_file_name_override);
483
+				$this->file_ext = $this->get_extension($this->_file_name_override);
484 484
 			}
485 485
 
486 486
 			if ( ! $this->is_allowed_filetype(TRUE))
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
 		// Convert the file size to kilobytes
494 494
 		if ($this->file_size > 0)
495 495
 		{
496
-			$this->file_size = round($this->file_size/1024, 2);
496
+			$this->file_size = round($this->file_size / 1024, 2);
497 497
 		}
498 498
 
499 499
 		// Is the file size within the allowed maximum?
@@ -818,10 +818,10 @@  discard block
 block discarded – undo
818 818
 			{
819 819
 				$types = array(1 => 'gif', 2 => 'jpeg', 3 => 'png');
820 820
 
821
-				$this->image_width	= $D[0];
822
-				$this->image_height	= $D[1];
823
-				$this->image_type	= isset($types[$D[2]]) ? $types[$D[2]] : 'unknown';
824
-				$this->image_size_str	= $D[3]; // string containing height and width
821
+				$this->image_width = $D[0];
822
+				$this->image_height = $D[1];
823
+				$this->image_type = isset($types[$D[2]]) ? $types[$D[2]] : 'unknown';
824
+				$this->image_size_str = $D[3]; // string containing height and width
825 825
 			}
826 826
 		}
827 827
 
@@ -869,7 +869,7 @@  discard block
 block discarded – undo
869 869
 			$this->file_type = 'image/jpeg';
870 870
 		}
871 871
 
872
-		$img_mimes = array('image/gif',	'image/jpeg', 'image/png');
872
+		$img_mimes = array('image/gif', 'image/jpeg', 'image/png');
873 873
 
874 874
 		return in_array($this->file_type, $img_mimes, TRUE);
875 875
 	}
@@ -1011,7 +1011,7 @@  discard block
 block discarded – undo
1011 1011
 			return FALSE;
1012 1012
 		}
1013 1013
 
1014
-		$this->upload_path = preg_replace('/(.+?)\/*$/', '\\1/',  $this->upload_path);
1014
+		$this->upload_path = preg_replace('/(.+?)\/*$/', '\\1/', $this->upload_path);
1015 1015
 		return TRUE;
1016 1016
 	}
1017 1017
 
@@ -1055,9 +1055,9 @@  discard block
 block discarded – undo
1055 1055
 		$ext = '';
1056 1056
 		if (strpos($filename, '.') !== FALSE)
1057 1057
 		{
1058
-			$parts		= explode('.', $filename);
1059
-			$ext		= '.'.array_pop($parts);
1060
-			$filename	= implode('.', $parts);
1058
+			$parts = explode('.', $filename);
1059
+			$ext = '.'.array_pop($parts);
1060
+			$filename = implode('.', $parts);
1061 1061
 		}
1062 1062
 
1063 1063
 		return substr($filename, 0, ($length - strlen($ext))).$ext;
Please login to merge, or discard this patch.
Braces   +21 added lines, -19 removed lines patch added patch discarded remove patch
@@ -327,19 +327,16 @@  discard block
 block discarded – undo
327 327
 					if ($reflection->hasMethod('set_'.$key))
328 328
 					{
329 329
 						$this->{'set_'.$key}($config[$key]);
330
-					}
331
-					else
330
+					} else
332 331
 					{
333 332
 						$this->$key = $config[$key];
334 333
 					}
335
-				}
336
-				else
334
+				} else
337 335
 				{
338 336
 					$this->$key = $defaults[$key];
339 337
 				}
340 338
 			}
341
-		}
342
-		else
339
+		} else
343 340
 		{
344 341
 			foreach ($config as $key => &$value)
345 342
 			{
@@ -348,8 +345,7 @@  discard block
 block discarded – undo
348 345
 					if ($reflection->hasMethod('set_'.$key))
349 346
 					{
350 347
 						$this->{'set_'.$key}($value);
351
-					}
352
-					else
348
+					} else
353 349
 					{
354 350
 						$this->$key = $value;
355 351
 					}
@@ -409,9 +405,11 @@  discard block
 block discarded – undo
409 405
 		}
410 406
 
411 407
 		// Was the file able to be uploaded? If not, determine the reason why.
412
-		if ( ! file_exists($_file['tmp_name']))	// modified by ci-phpunit-test
408
+		if ( ! file_exists($_file['tmp_name'])) {
409
+			// modified by ci-phpunit-test
413 410
 		{
414 411
 			$error = isset($_file['error']) ? $_file['error'] : 4;
412
+		}
415 413
 
416 414
 			switch ($error)
417 415
 			{
@@ -476,8 +474,7 @@  discard block
 block discarded – undo
476 474
 			if (strpos($this->_file_name_override, '.') === FALSE)
477 475
 			{
478 476
 				$this->file_name .= $this->file_ext;
479
-			}
480
-			else
477
+			} else
481 478
 			{
482 479
 				// An extension was provided, let's have it!
483 480
 				$this->file_ext	= $this->get_extension($this->_file_name_override);
@@ -677,8 +674,7 @@  discard block
 block discarded – undo
677 674
 		{
678 675
 			$this->set_error('upload_bad_filename', 'debug');
679 676
 			return FALSE;
680
-		}
681
-		else
677
+		} else
682 678
 		{
683 679
 			return $new_filename;
684 680
 		}
@@ -863,8 +859,7 @@  discard block
 block discarded – undo
863 859
 		if (in_array($this->file_type, $png_mimes))
864 860
 		{
865 861
 			$this->file_type = 'image/png';
866
-		}
867
-		elseif (in_array($this->file_type, $jpeg_mimes))
862
+		} elseif (in_array($this->file_type, $jpeg_mimes))
868 863
 		{
869 864
 			$this->file_type = 'image/jpeg';
870 865
 		}
@@ -1116,9 +1111,12 @@  discard block
 block discarded – undo
1116 1111
 
1117 1112
 		if (function_exists('getimagesize') && @getimagesize($file) !== FALSE)
1118 1113
 		{
1119
-			if (($file = @fopen($file, 'rb')) === FALSE) // "b" to force binary
1114
+			if (($file = @fopen($file, 'rb')) === FALSE) {
1115
+				// "b" to force binary
1120 1116
 			{
1121
-				return FALSE; // Couldn't open the file, return FALSE
1117
+				return FALSE;
1118
+			}
1119
+			// Couldn't open the file, return FALSE
1122 1120
 			}
1123 1121
 
1124 1122
 			$opening_bytes = fread($file, 256);
@@ -1220,9 +1218,11 @@  discard block
 block discarded – undo
1220 1218
 
1221 1219
 		// Fileinfo extension - most reliable method
1222 1220
 		$finfo = @finfo_open(FILEINFO_MIME);
1223
-		if (is_resource($finfo)) // It is possible that a FALSE value is returned, if there is no magic MIME database file found on the system
1221
+		if (is_resource($finfo)) {
1222
+			// It is possible that a FALSE value is returned, if there is no magic MIME database file found on the system
1224 1223
 		{
1225 1224
 			$mime = @finfo_file($finfo, $file['tmp_name']);
1225
+		}
1226 1226
 			finfo_close($finfo);
1227 1227
 
1228 1228
 			/* According to the comments section of the PHP manual page,
@@ -1306,10 +1306,12 @@  discard block
 block discarded – undo
1306 1306
 		if (function_exists('mime_content_type'))
1307 1307
 		{
1308 1308
 			$this->file_type = @mime_content_type($file['tmp_name']);
1309
-			if (strlen($this->file_type) > 0) // It's possible that mime_content_type() returns FALSE or an empty string
1309
+			if (strlen($this->file_type) > 0) {
1310
+				// It's possible that mime_content_type() returns FALSE or an empty string
1310 1311
 			{
1311 1312
 				return;
1312 1313
 			}
1314
+			}
1313 1315
 		}
1314 1316
 
1315 1317
 		$this->file_type = $file['type'];
Please login to merge, or discard this patch.