Completed
Pull Request — master (#364)
by Kenji
02:19
created
application/tests/Bootstrap.php 2 patches
Switch Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -69,28 +69,28 @@
 block discarded – undo
69 69
  */
70 70
 switch (ENVIRONMENT)
71 71
 {
72
-	case 'testing':
73
-	case 'development':
74
-		error_reporting(-1);
75
-		ini_set('display_errors', 1);
76
-	break;
77
-
78
-	case 'production':
79
-		ini_set('display_errors', 0);
80
-		if (version_compare(PHP_VERSION, '5.3', '>='))
81
-		{
82
-			error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
83
-		}
84
-		else
85
-		{
86
-			error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE);
87
-		}
88
-	break;
89
-
90
-	default:
91
-		header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
92
-		echo 'The application environment is not set correctly.';
93
-		exit(1); // EXIT_ERROR
72
+		case 'testing':
73
+		case 'development':
74
+			error_reporting(-1);
75
+			ini_set('display_errors', 1);
76
+		break;
77
+
78
+		case 'production':
79
+			ini_set('display_errors', 0);
80
+			if (version_compare(PHP_VERSION, '5.3', '>='))
81
+			{
82
+				error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
83
+			}
84
+			else
85
+			{
86
+				error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE);
87
+			}
88
+		break;
89
+
90
+		default:
91
+			header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
92
+			echo 'The application environment is not set correctly.';
93
+			exit(1); // EXIT_ERROR
94 94
 }
95 95
 
96 96
 /*
Please login to merge, or discard this patch.
Braces   +10 added lines, -20 removed lines patch added patch discarded remove patch
@@ -80,8 +80,7 @@  discard block
 block discarded – undo
80 80
 		if (version_compare(PHP_VERSION, '5.3', '>='))
81 81
 		{
82 82
 			error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED);
83
-		}
84
-		else
83
+		} else
85 84
 		{
86 85
 			error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE);
87 86
 		}
@@ -204,8 +203,7 @@  discard block
 block discarded – undo
204 203
 	if (($_temp = realpath($system_path)) !== FALSE)
205 204
 	{
206 205
 		$system_path = $_temp.DIRECTORY_SEPARATOR;
207
-	}
208
-	else
206
+	} else
209 207
 	{
210 208
 		// Ensure there's a trailing slash
211 209
 		$system_path = strtr(
@@ -249,8 +247,7 @@  discard block
 block discarded – undo
249 247
 		if (($_temp = realpath($application_folder)) !== FALSE)
250 248
 		{
251 249
 			$application_folder = $_temp;
252
-		}
253
-		else
250
+		} else
254 251
 		{
255 252
 			$application_folder = strtr(
256 253
 				rtrim($application_folder, '/\\'),
@@ -258,16 +255,14 @@  discard block
 block discarded – undo
258 255
 				DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
259 256
 			);
260 257
 		}
261
-	}
262
-	elseif (is_dir(BASEPATH.$application_folder.DIRECTORY_SEPARATOR))
258
+	} elseif (is_dir(BASEPATH.$application_folder.DIRECTORY_SEPARATOR))
263 259
 	{
264 260
 		$application_folder = BASEPATH.strtr(
265 261
 			trim($application_folder, '/\\'),
266 262
 			'/\\',
267 263
 			DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
268 264
 		);
269
-	}
270
-	else
265
+	} else
271 266
 	{
272 267
 		header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
273 268
 		echo 'Your application folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF;
@@ -280,14 +275,12 @@  discard block
 block discarded – undo
280 275
 	if ( ! isset($view_folder[0]) && is_dir(APPPATH.'views'.DIRECTORY_SEPARATOR))
281 276
 	{
282 277
 		$view_folder = APPPATH.'views';
283
-	}
284
-	elseif (is_dir($view_folder))
278
+	} elseif (is_dir($view_folder))
285 279
 	{
286 280
 		if (($_temp = realpath($view_folder)) !== FALSE)
287 281
 		{
288 282
 			$view_folder = $_temp;
289
-		}
290
-		else
283
+		} else
291 284
 		{
292 285
 			$view_folder = strtr(
293 286
 				rtrim($view_folder, '/\\'),
@@ -295,16 +288,14 @@  discard block
 block discarded – undo
295 288
 				DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
296 289
 			);
297 290
 		}
298
-	}
299
-	elseif (is_dir(APPPATH.$view_folder.DIRECTORY_SEPARATOR))
291
+	} elseif (is_dir(APPPATH.$view_folder.DIRECTORY_SEPARATOR))
300 292
 	{
301 293
 		$view_folder = APPPATH.strtr(
302 294
 			trim($view_folder, '/\\'),
303 295
 			'/\\',
304 296
 			DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR
305 297
 		);
306
-	}
307
-	else
298
+	} else
308 299
 	{
309 300
 		header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
310 301
 		echo 'Your view folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF;
@@ -317,8 +308,7 @@  discard block
 block discarded – undo
317 308
 	if (is_file(TESTPATH . '_ci_phpunit_test' . DIRECTORY_SEPARATOR . 'CIPHPUnitTest.php'))
318 309
 	{
319 310
 		define('CI_PHPUNIT_TESTPATH', TESTPATH . '_ci_phpunit_test' . DIRECTORY_SEPARATOR);
320
-	}
321
-	else
311
+	} else
322 312
 	{
323 313
 		// Assume Composer with a vendor directory parallel to the application directory
324 314
 		define('CI_PHPUNIT_TESTPATH', implode(
Please login to merge, or discard this patch.
application/tests/_ci_phpunit_test/CIPHPUnitTestFileCache.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -67,8 +67,7 @@
 block discarded – undo
67 67
 		if ($this->offsetExists($key))
68 68
 		{
69 69
 			return $this->map[$key];
70
-		}
71
-		else
70
+		} else
72 71
 		{
73 72
 			return null;
74 73
 		}
Please login to merge, or discard this patch.
application/tests/_ci_phpunit_test/CIPHPUnitTestRouter.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -29,16 +29,14 @@
 block discarded – undo
29 29
 		if (empty($class) OR ! file_exists(APPPATH.'controllers/'.$RTR->directory.$class.'.php'))
30 30
 		{
31 31
 			$e404 = TRUE;
32
-		}
33
-		else
32
+		} else
34 33
 		{
35 34
 			require_once(APPPATH.'controllers/'.$RTR->directory.$class.'.php');
36 35
 
37 36
 			if ( ! class_exists($class, FALSE) OR $method[0] === '_' OR method_exists('CI_Controller', $method))
38 37
 			{
39 38
 				$e404 = TRUE;
40
-			}
41
-			elseif (method_exists($class, '_remap'))
39
+			} elseif (method_exists($class, '_remap'))
42 40
 			{
43 41
 				$params = array($method, array_slice($URI->rsegments, 2));
44 42
 				$method = '_remap';
Please login to merge, or discard this patch.
application/tests/_ci_phpunit_test/functions.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -39,8 +39,7 @@
 block discarded – undo
39 39
 		{
40 40
 			$CI->db->close();
41 41
 			$CI->db = null;
42
-		}
43
-		else
42
+		} else
44 43
 		{
45 44
 			// Don't close if SQLite in-memory database
46 45
 			// If we close it, all tables and stored data will be gone
Please login to merge, or discard this patch.
application/tests/_ci_phpunit_test/patcher/InvocationVerifier.php 1 patch
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -31,12 +31,10 @@  discard block
 block discarded – undo
31 31
 				if ($invoked === false)
32 32
 				{
33 33
 					$actual_times = 0;
34
-				}
35
-				elseif ($expected_params === null)
34
+				} elseif ($expected_params === null)
36 35
 				{
37 36
 					$actual_times = count($invocations[$class_method]);
38
-				}
39
-				else
37
+				} else
40 38
 				{
41 39
 					$count = 0;
42 40
 					foreach ($invocations[$class_method] as $actual_params)
@@ -56,16 +54,14 @@  discard block
 block discarded – undo
56 54
 						$actual_times,
57 55
 						$class_method . '() expected to be not invoked, but invoked ' . $actual_times . ' times.'
58 56
 					);
59
-				}
60
-				elseif ($expected_times === '+')
57
+				} elseif ($expected_times === '+')
61 58
 				{
62 59
 					PHPUnit_Framework_TestCase::assertGreaterThanOrEqual(
63 60
 						1,
64 61
 						$actual_times,
65 62
 						$class_method . '() expected to be invoked at least one time, but invoked ' . $actual_times . ' times.'
66 63
 					);
67
-				}
68
-				else
64
+				} else
69 65
 				{
70 66
 					PHPUnit_Framework_TestCase::assertEquals(
71 67
 						$expected_times,
Please login to merge, or discard this patch.
application/tests/_ci_phpunit_test/patcher/MonkeyPatch.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -60,8 +60,7 @@
 block discarded – undo
60 60
 		if (strpos($class_method, '::') === false)
61 61
 		{
62 62
 			return 'Kenjis\MonkeyPatch\Patcher\FunctionPatcher\Proxy';
63
-		}
64
-		else
63
+		} else
65 64
 		{
66 65
 			return 'Kenjis\MonkeyPatch\Patcher\MethodPatcher\PatchManager';
67 66
 		}
Please login to merge, or discard this patch.
application/tests/_ci_phpunit_test/patcher/functions/exit__.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,8 +19,7 @@
 block discarded – undo
19 19
 	if ($class === null)
20 20
 	{
21 21
 		$message = 'exit() called in ' . $method . '() function';
22
-	}
23
-	else
22
+	} else
24 23
 	{
25 24
 		$message = 'exit() called in ' . $class . '::' . $method . '()';
26 25
 	}
Please login to merge, or discard this patch.
application/tests/mocks/autoloader.php 1 patch
Braces   +8 added lines, -16 removed lines patch added patch discarded remove patch
@@ -63,8 +63,7 @@  discard block
 block discarded – undo
63 63
 	if (strpos($class, 'Mock_') === 0)
64 64
 	{
65 65
 		$class = strtolower(str_replace(array('Mock_', '_'), array('', DIRECTORY_SEPARATOR), $class));
66
-	}
67
-	elseif (strpos($class, 'CI_') === 0)
66
+	} elseif (strpos($class, 'CI_') === 0)
68 67
 	{
69 68
 		$subclass = substr($class, 3);
70 69
 
@@ -72,39 +71,32 @@  discard block
 block discarded – undo
72 71
 		{
73 72
 			$dir = SYSTEM_PATH.'core'.DIRECTORY_SEPARATOR;
74 73
 			$class = $subclass;
75
-		}
76
-		elseif (in_array($subclass, $ci_libraries))
74
+		} elseif (in_array($subclass, $ci_libraries))
77 75
 		{
78 76
 			$dir = SYSTEM_PATH.'libraries'.DIRECTORY_SEPARATOR;
79 77
 			$class = ($subclass === 'Driver_Library') ? 'Driver' : $subclass;
80
-		}
81
-		elseif (in_array($subclass, $ci_drivers))
78
+		} elseif (in_array($subclass, $ci_drivers))
82 79
 		{
83 80
 			$dir = SYSTEM_PATH.'libraries'.DIRECTORY_SEPARATOR.$subclass.DIRECTORY_SEPARATOR;
84 81
 			$class = $subclass;
85
-		}
86
-		elseif (in_array(($parent = strtok($subclass, '_')), $ci_drivers)) {
82
+		} elseif (in_array(($parent = strtok($subclass, '_')), $ci_drivers)) {
87 83
 			$dir = SYSTEM_PATH.'libraries'.DIRECTORY_SEPARATOR.$parent.DIRECTORY_SEPARATOR.'drivers'.DIRECTORY_SEPARATOR;
88 84
 			$class = $subclass;
89
-		}
90
-		elseif (preg_match('/^CI_DB_(.+)_(.+)_(driver|forge|result|utility)$/', $class, $m) && count($m) === 4)
85
+		} elseif (preg_match('/^CI_DB_(.+)_(.+)_(driver|forge|result|utility)$/', $class, $m) && count($m) === 4)
91 86
 		{
92 87
 			$driver_path = SYSTEM_PATH.'database'.DIRECTORY_SEPARATOR.'drivers'.DIRECTORY_SEPARATOR;
93 88
 			$dir = $driver_path.$m[1].DIRECTORY_SEPARATOR.'subdrivers'.DIRECTORY_SEPARATOR;
94 89
 			$file = $dir.$m[1].'_'.$m[2].'_'.$m[3].'.php';
95
-		}
96
-		elseif (preg_match('/^CI_DB_(.+)_(driver|forge|result|utility)$/', $class, $m) && count($m) === 3)
90
+		} elseif (preg_match('/^CI_DB_(.+)_(driver|forge|result|utility)$/', $class, $m) && count($m) === 3)
97 91
 		{
98 92
 			$driver_path = SYSTEM_PATH.'database'.DIRECTORY_SEPARATOR.'drivers'.DIRECTORY_SEPARATOR;
99 93
 			$dir = $driver_path.$m[1].DIRECTORY_SEPARATOR;
100 94
 			$file = $dir.$m[1].'_'.$m[2].'.php';
101
-		}
102
-		elseif (strpos($class, 'CI_DB') === 0)
95
+		} elseif (strpos($class, 'CI_DB') === 0)
103 96
 		{
104 97
 			$dir = SYSTEM_PATH.'database'.DIRECTORY_SEPARATOR;
105 98
 			$file = $dir.str_replace(array('CI_DB','active_record'), array('DB', 'active_rec'), $subclass).'.php';
106
-		}
107
-		else
99
+		} else
108 100
 		{
109 101
 			$class = strtolower($class);
110 102
 		}
Please login to merge, or discard this patch.
application/tests/_ci_phpunit_test/replacing/core/CodeIgniter.php 1 patch
Braces   +10 added lines, -20 removed lines patch added patch discarded remove patch
@@ -169,12 +169,10 @@  discard block
 block discarded – undo
169 169
 			file_exists(APPPATH.'vendor/autoload.php')
170 170
 				? require_once(APPPATH.'vendor/autoload.php')
171 171
 				: log_message('error', '$config[\'composer_autoload\'] is set to TRUE but '.APPPATH.'vendor/autoload.php was not found.');
172
-		}
173
-		elseif (file_exists($composer_autoload))
172
+		} elseif (file_exists($composer_autoload))
174 173
 		{
175 174
 			require_once($composer_autoload);
176
-		}
177
-		else
175
+		} else
178 176
 		{
179 177
 			log_message('error', 'Could not find the specified $config[\'composer_autoload\'] path: '.$composer_autoload);
180 178
 		}
@@ -253,8 +251,7 @@  discard block
 block discarded – undo
253 251
 		// This is required for mb_convert_encoding() to strip invalid characters.
254 252
 		// That's utilized by CI_Utf8, but it's also done for consistency with iconv.
255 253
 		mb_substitute_character('none');
256
-	}
257
-	else
254
+	} else
258 255
 	{
259 256
 		define('MB_ENABLED', FALSE);
260 257
 	}
@@ -267,8 +264,7 @@  discard block
 block discarded – undo
267 264
 		// iconv.internal_encoding is deprecated starting with PHP 5.6
268 265
 		// and it's usage triggers E_DEPRECATED messages.
269 266
 		@ini_set('iconv.internal_encoding', $charset);
270
-	}
271
-	else
267
+	} else
272 268
 	{
273 269
 		define('ICONV_ENABLED', FALSE);
274 270
 	}
@@ -378,8 +374,7 @@  discard block
 block discarded – undo
378 374
 		if (! CIPHPUnitTest::wiredesignzHmvcInstalled())
379 375
 		{
380 376
 			return CI_Controller::get_instance();
381
-		}
382
-		else
377
+		} else
383 378
 		{
384 379
 			return CI::$APP;
385 380
 		}
@@ -424,21 +419,18 @@  discard block
 block discarded – undo
424 419
 	if (empty($class) OR ! file_exists(APPPATH.'controllers/'.$RTR->directory.$class.'.php'))
425 420
 	{
426 421
 		$e404 = TRUE;
427
-	}
428
-	else
422
+	} else
429 423
 	{
430 424
 		require_once(APPPATH.'controllers/'.$RTR->directory.$class.'.php');
431 425
 
432 426
 		if ( ! class_exists($class, FALSE) OR $method[0] === '_' OR method_exists('CI_Controller', $method))
433 427
 		{
434 428
 			$e404 = TRUE;
435
-		}
436
-		elseif (method_exists($class, '_remap'))
429
+		} elseif (method_exists($class, '_remap'))
437 430
 		{
438 431
 			$params = array($method, array_slice($URI->rsegments, 2));
439 432
 			$method = '_remap';
440
-		}
441
-		elseif ( ! method_exists($class, $method))
433
+		} elseif ( ! method_exists($class, $method))
442 434
 		{
443 435
 			$e404 = TRUE;
444 436
 		}
@@ -490,8 +482,7 @@  discard block
 block discarded – undo
490 482
 						$RTR->directory = '';
491 483
 					}
492 484
 				}
493
-			}
494
-			else
485
+			} else
495 486
 			{
496 487
 				$e404 = FALSE;
497 488
 			}
@@ -507,8 +498,7 @@  discard block
 block discarded – undo
507 498
 				1 => $class,
508 499
 				2 => $method
509 500
 			);
510
-		}
511
-		else
501
+		} else
512 502
 		{
513 503
 			show_404($RTR->directory.$class.'/'.$method);
514 504
 		}
Please login to merge, or discard this patch.