@@ -69,28 +69,28 @@ |
||
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 | /* |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * NOTE: If you change these, also change the error_reporting() code below |
55 | 55 | */ |
56 | 56 | // This `if` statemant is needed for @runInSeparateProcess |
57 | -if (! defined('ENVIRONMENT')) |
|
57 | +if ( ! defined('ENVIRONMENT')) |
|
58 | 58 | { |
59 | 59 | define('ENVIRONMENT', 'testing'); |
60 | 60 | } |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME)); |
234 | 234 | |
235 | 235 | // Path to the test directory containing all the test files. |
236 | - define('TESTPATH', __dir__.DIRECTORY_SEPARATOR); // Should be the folder this `Bootstrap.php` file is in. |
|
236 | + define('TESTPATH', __dir__.DIRECTORY_SEPARATOR); // Should be the folder this `Bootstrap.php` file is in. |
|
237 | 237 | |
238 | 238 | // Path to the system directory |
239 | 239 | define('BASEPATH', $system_path); |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | * Added for ci-phpunit-test |
361 | 361 | * ------------------------------------------------------------------- |
362 | 362 | */ |
363 | -require __DIR__ . '/_ci_phpunit_test/CIPHPUnitTest.php'; |
|
363 | +require __DIR__.'/_ci_phpunit_test/CIPHPUnitTest.php'; |
|
364 | 364 | CIPHPUnitTest::init(); |
365 | 365 | /* |
366 | 366 | * Or you can set directories for autoloading |
@@ -200,16 +200,14 @@ discard block |
||
200 | 200 | if (empty($library)) |
201 | 201 | { |
202 | 202 | return $this; |
203 | - } |
|
204 | - elseif (is_array($library)) |
|
203 | + } elseif (is_array($library)) |
|
205 | 204 | { |
206 | 205 | foreach ($library as $key => $value) |
207 | 206 | { |
208 | 207 | if (is_int($key)) |
209 | 208 | { |
210 | 209 | $this->library($value, $params); |
211 | - } |
|
212 | - else |
|
210 | + } else |
|
213 | 211 | { |
214 | 212 | $this->library($key, $params, $value); |
215 | 213 | } |
@@ -246,8 +244,7 @@ discard block |
||
246 | 244 | if (empty($model)) |
247 | 245 | { |
248 | 246 | return $this; |
249 | - } |
|
250 | - elseif (is_array($model)) |
|
247 | + } elseif (is_array($model)) |
|
251 | 248 | { |
252 | 249 | foreach ($model as $key => $value) |
253 | 250 | { |
@@ -313,8 +310,7 @@ discard block |
||
313 | 310 | { |
314 | 311 | throw new RuntimeException($app_path."Model.php exists, but doesn't declare class CI_Model"); |
315 | 312 | } |
316 | - } |
|
317 | - elseif ( ! class_exists('CI_Model', FALSE)) |
|
313 | + } elseif ( ! class_exists('CI_Model', FALSE)) |
|
318 | 314 | { |
319 | 315 | require_once(BASEPATH.'core'.DIRECTORY_SEPARATOR.'Model.php'); |
320 | 316 | } |
@@ -471,8 +467,7 @@ discard block |
||
471 | 467 | require_once($driver_path); |
472 | 468 | $class = 'CI_DB_'.$db->dbdriver.'_'.$db->subdriver.'_forge'; |
473 | 469 | } |
474 | - } |
|
475 | - else |
|
470 | + } else |
|
476 | 471 | { |
477 | 472 | $class = 'CI_DB_'.$db->dbdriver.'_forge'; |
478 | 473 | } |
@@ -761,16 +756,14 @@ discard block |
||
761 | 756 | if (is_int($key)) |
762 | 757 | { |
763 | 758 | $this->driver($value, $params); |
764 | - } |
|
765 | - else |
|
759 | + } else |
|
766 | 760 | { |
767 | 761 | $this->driver($key, $params, $value); |
768 | 762 | } |
769 | 763 | } |
770 | 764 | |
771 | 765 | return $this; |
772 | - } |
|
773 | - elseif (empty($library)) |
|
766 | + } elseif (empty($library)) |
|
774 | 767 | { |
775 | 768 | return FALSE; |
776 | 769 | } |
@@ -869,8 +862,7 @@ discard block |
||
869 | 862 | array_shift($this->_ci_helper_paths); |
870 | 863 | array_shift($this->_ci_view_paths); |
871 | 864 | array_pop($config->_config_paths); |
872 | - } |
|
873 | - else |
|
865 | + } else |
|
874 | 866 | { |
875 | 867 | $path = rtrim($path, '/').'/'; |
876 | 868 | foreach (array('_ci_library_paths', '_ci_model_paths', '_ci_helper_paths') as $var) |
@@ -934,8 +926,7 @@ discard block |
||
934 | 926 | { |
935 | 927 | $_ci_x = explode('/', $_ci_path); |
936 | 928 | $_ci_file = end($_ci_x); |
937 | - } |
|
938 | - else |
|
929 | + } else |
|
939 | 930 | { |
940 | 931 | $_ci_ext = pathinfo($_ci_view, PATHINFO_EXTENSION); |
941 | 932 | $_ci_file = ($_ci_ext === '') ? $_ci_view.'.php' : $_ci_view; |
@@ -1002,8 +993,7 @@ discard block |
||
1002 | 993 | if ( ! is_php('5.4') && ! ini_get('short_open_tag') && config_item('rewrite_short_tags') === TRUE) |
1003 | 994 | { |
1004 | 995 | echo eval('?>'.preg_replace('/;*\s*\?>/', '; ?>', str_replace('<?=', '<?php echo ', file_get_contents($_ci_path)))); |
1005 | - } |
|
1006 | - else |
|
996 | + } else |
|
1007 | 997 | { |
1008 | 998 | include($_ci_path); // include() vs include_once() allows for multiple views with the same name |
1009 | 999 | } |
@@ -1030,8 +1020,7 @@ discard block |
||
1030 | 1020 | if (ob_get_level() > $this->_ci_ob_level + 1) |
1031 | 1021 | { |
1032 | 1022 | ob_end_flush(); |
1033 | - } |
|
1034 | - else |
|
1023 | + } else |
|
1035 | 1024 | { |
1036 | 1025 | $_ci_CI->output->append_output(ob_get_contents()); |
1037 | 1026 | @ob_end_clean(); |
@@ -1071,8 +1060,7 @@ discard block |
||
1071 | 1060 | |
1072 | 1061 | // Get the filename from the path |
1073 | 1062 | $class = substr($class, $last_slash); |
1074 | - } |
|
1075 | - else |
|
1063 | + } else |
|
1076 | 1064 | { |
1077 | 1065 | $subdir = ''; |
1078 | 1066 | } |
@@ -1210,8 +1198,7 @@ discard block |
||
1210 | 1198 | if (file_exists(TESTPATH.'_ci_phpunit_test/replacing/libraries/'.$file_path.$library_name.'.php')) |
1211 | 1199 | { |
1212 | 1200 | include_once(TESTPATH.'_ci_phpunit_test/replacing/libraries/'.$file_path.$library_name.'.php'); |
1213 | - } |
|
1214 | - else |
|
1201 | + } else |
|
1215 | 1202 | { |
1216 | 1203 | include_once(BASEPATH.'libraries/'.$file_path.$library_name.'.php'); |
1217 | 1204 | } |
@@ -1227,8 +1214,7 @@ discard block |
||
1227 | 1214 | { |
1228 | 1215 | $prefix = config_item('subclass_prefix'); |
1229 | 1216 | break; |
1230 | - } |
|
1231 | - else |
|
1217 | + } else |
|
1232 | 1218 | { |
1233 | 1219 | log_message('debug', $path.' exists, but does not declare '.$subclass); |
1234 | 1220 | } |
@@ -1277,8 +1263,7 @@ discard block |
||
1277 | 1263 | { |
1278 | 1264 | include($path.'config/'.strtolower($class).'.php'); |
1279 | 1265 | $found = TRUE; |
1280 | - } |
|
1281 | - elseif (file_exists($path.'config/'.ucfirst(strtolower($class)).'.php')) |
|
1266 | + } elseif (file_exists($path.'config/'.ucfirst(strtolower($class)).'.php')) |
|
1282 | 1267 | { |
1283 | 1268 | include($path.'config/'.ucfirst(strtolower($class)).'.php'); |
1284 | 1269 | $found = TRUE; |
@@ -1288,8 +1273,7 @@ discard block |
||
1288 | 1273 | { |
1289 | 1274 | include($path.'config/'.ENVIRONMENT.'/'.strtolower($class).'.php'); |
1290 | 1275 | $found = TRUE; |
1291 | - } |
|
1292 | - elseif (file_exists($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php')) |
|
1276 | + } elseif (file_exists($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php')) |
|
1293 | 1277 | { |
1294 | 1278 | include($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php'); |
1295 | 1279 | $found = TRUE; |
@@ -200,16 +200,14 @@ discard block |
||
200 | 200 | if (empty($library)) |
201 | 201 | { |
202 | 202 | return $this; |
203 | - } |
|
204 | - elseif (is_array($library)) |
|
203 | + } elseif (is_array($library)) |
|
205 | 204 | { |
206 | 205 | foreach ($library as $key => $value) |
207 | 206 | { |
208 | 207 | if (is_int($key)) |
209 | 208 | { |
210 | 209 | $this->library($value, $params); |
211 | - } |
|
212 | - else |
|
210 | + } else |
|
213 | 211 | { |
214 | 212 | $this->library($key, $params, $value); |
215 | 213 | } |
@@ -246,8 +244,7 @@ discard block |
||
246 | 244 | if (empty($model)) |
247 | 245 | { |
248 | 246 | return $this; |
249 | - } |
|
250 | - elseif (is_array($model)) |
|
247 | + } elseif (is_array($model)) |
|
251 | 248 | { |
252 | 249 | foreach ($model as $key => $value) |
253 | 250 | { |
@@ -313,8 +310,7 @@ discard block |
||
313 | 310 | { |
314 | 311 | throw new RuntimeException($app_path."Model.php exists, but doesn't declare class CI_Model"); |
315 | 312 | } |
316 | - } |
|
317 | - elseif ( ! class_exists('CI_Model', FALSE)) |
|
313 | + } elseif ( ! class_exists('CI_Model', FALSE)) |
|
318 | 314 | { |
319 | 315 | require_once(BASEPATH.'core'.DIRECTORY_SEPARATOR.'Model.php'); |
320 | 316 | } |
@@ -471,8 +467,7 @@ discard block |
||
471 | 467 | require_once($driver_path); |
472 | 468 | $class = 'CI_DB_'.$db->dbdriver.'_'.$db->subdriver.'_forge'; |
473 | 469 | } |
474 | - } |
|
475 | - else |
|
470 | + } else |
|
476 | 471 | { |
477 | 472 | $class = 'CI_DB_'.$db->dbdriver.'_forge'; |
478 | 473 | } |
@@ -761,16 +756,14 @@ discard block |
||
761 | 756 | if (is_int($key)) |
762 | 757 | { |
763 | 758 | $this->driver($value, $params); |
764 | - } |
|
765 | - else |
|
759 | + } else |
|
766 | 760 | { |
767 | 761 | $this->driver($key, $params, $value); |
768 | 762 | } |
769 | 763 | } |
770 | 764 | |
771 | 765 | return $this; |
772 | - } |
|
773 | - elseif (empty($library)) |
|
766 | + } elseif (empty($library)) |
|
774 | 767 | { |
775 | 768 | return FALSE; |
776 | 769 | } |
@@ -869,8 +862,7 @@ discard block |
||
869 | 862 | array_shift($this->_ci_helper_paths); |
870 | 863 | array_shift($this->_ci_view_paths); |
871 | 864 | array_pop($config->_config_paths); |
872 | - } |
|
873 | - else |
|
865 | + } else |
|
874 | 866 | { |
875 | 867 | $path = rtrim($path, '/').'/'; |
876 | 868 | foreach (array('_ci_library_paths', '_ci_model_paths', '_ci_helper_paths') as $var) |
@@ -934,8 +926,7 @@ discard block |
||
934 | 926 | { |
935 | 927 | $_ci_x = explode('/', $_ci_path); |
936 | 928 | $_ci_file = end($_ci_x); |
937 | - } |
|
938 | - else |
|
929 | + } else |
|
939 | 930 | { |
940 | 931 | $_ci_ext = pathinfo($_ci_view, PATHINFO_EXTENSION); |
941 | 932 | $_ci_file = ($_ci_ext === '') ? $_ci_view.'.php' : $_ci_view; |
@@ -1013,8 +1004,7 @@ discard block |
||
1013 | 1004 | if ( ! is_php('5.4') && ! ini_get('short_open_tag') && config_item('rewrite_short_tags') === TRUE) |
1014 | 1005 | { |
1015 | 1006 | echo eval('?>'.preg_replace('/;*\s*\?>/', '; ?>', str_replace('<?=', '<?php echo ', file_get_contents($_ci_path)))); |
1016 | - } |
|
1017 | - else |
|
1007 | + } else |
|
1018 | 1008 | { |
1019 | 1009 | include($_ci_path); // include() vs include_once() allows for multiple views with the same name |
1020 | 1010 | } |
@@ -1041,8 +1031,7 @@ discard block |
||
1041 | 1031 | if (ob_get_level() > $this->_ci_ob_level + 1) |
1042 | 1032 | { |
1043 | 1033 | ob_end_flush(); |
1044 | - } |
|
1045 | - else |
|
1034 | + } else |
|
1046 | 1035 | { |
1047 | 1036 | $_ci_CI->output->append_output(ob_get_contents()); |
1048 | 1037 | @ob_end_clean(); |
@@ -1082,8 +1071,7 @@ discard block |
||
1082 | 1071 | |
1083 | 1072 | // Get the filename from the path |
1084 | 1073 | $class = substr($class, $last_slash); |
1085 | - } |
|
1086 | - else |
|
1074 | + } else |
|
1087 | 1075 | { |
1088 | 1076 | $subdir = ''; |
1089 | 1077 | } |
@@ -1221,8 +1209,7 @@ discard block |
||
1221 | 1209 | if (file_exists(TESTPATH.'_ci_phpunit_test/replacing/libraries/'.$file_path.$library_name.'.php')) |
1222 | 1210 | { |
1223 | 1211 | include_once(TESTPATH.'_ci_phpunit_test/replacing/libraries/'.$file_path.$library_name.'.php'); |
1224 | - } |
|
1225 | - else |
|
1212 | + } else |
|
1226 | 1213 | { |
1227 | 1214 | include_once(BASEPATH.'libraries/'.$file_path.$library_name.'.php'); |
1228 | 1215 | } |
@@ -1238,8 +1225,7 @@ discard block |
||
1238 | 1225 | { |
1239 | 1226 | $prefix = config_item('subclass_prefix'); |
1240 | 1227 | break; |
1241 | - } |
|
1242 | - else |
|
1228 | + } else |
|
1243 | 1229 | { |
1244 | 1230 | log_message('debug', $path.' exists, but does not declare '.$subclass); |
1245 | 1231 | } |
@@ -1288,8 +1274,7 @@ discard block |
||
1288 | 1274 | { |
1289 | 1275 | include($path.'config/'.strtolower($class).'.php'); |
1290 | 1276 | $found = TRUE; |
1291 | - } |
|
1292 | - elseif (file_exists($path.'config/'.ucfirst(strtolower($class)).'.php')) |
|
1277 | + } elseif (file_exists($path.'config/'.ucfirst(strtolower($class)).'.php')) |
|
1293 | 1278 | { |
1294 | 1279 | include($path.'config/'.ucfirst(strtolower($class)).'.php'); |
1295 | 1280 | $found = TRUE; |
@@ -1299,8 +1284,7 @@ discard block |
||
1299 | 1284 | { |
1300 | 1285 | include($path.'config/'.ENVIRONMENT.'/'.strtolower($class).'.php'); |
1301 | 1286 | $found = TRUE; |
1302 | - } |
|
1303 | - elseif (file_exists($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php')) |
|
1287 | + } elseif (file_exists($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php')) |
|
1304 | 1288 | { |
1305 | 1289 | include($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php'); |
1306 | 1290 | $found = TRUE; |
@@ -1496,8 +1480,7 @@ discard block |
||
1496 | 1480 | if ( ! is_array($filename)) |
1497 | 1481 | { |
1498 | 1482 | return array(strtolower(str_replace(array($extension, '.php'), '', $filename).$extension)); |
1499 | - } |
|
1500 | - else |
|
1483 | + } else |
|
1501 | 1484 | { |
1502 | 1485 | foreach ($filename as $key => $val) |
1503 | 1486 | { |
@@ -200,16 +200,14 @@ discard block |
||
200 | 200 | if (empty($library)) |
201 | 201 | { |
202 | 202 | return $this; |
203 | - } |
|
204 | - elseif (is_array($library)) |
|
203 | + } elseif (is_array($library)) |
|
205 | 204 | { |
206 | 205 | foreach ($library as $key => $value) |
207 | 206 | { |
208 | 207 | if (is_int($key)) |
209 | 208 | { |
210 | 209 | $this->library($value, $params); |
211 | - } |
|
212 | - else |
|
210 | + } else |
|
213 | 211 | { |
214 | 212 | $this->library($key, $params, $value); |
215 | 213 | } |
@@ -246,8 +244,7 @@ discard block |
||
246 | 244 | if (empty($model)) |
247 | 245 | { |
248 | 246 | return $this; |
249 | - } |
|
250 | - elseif (is_array($model)) |
|
247 | + } elseif (is_array($model)) |
|
251 | 248 | { |
252 | 249 | foreach ($model as $key => $value) |
253 | 250 | { |
@@ -313,8 +310,7 @@ discard block |
||
313 | 310 | { |
314 | 311 | throw new RuntimeException($app_path."Model.php exists, but doesn't declare class CI_Model"); |
315 | 312 | } |
316 | - } |
|
317 | - elseif ( ! class_exists('CI_Model', FALSE)) |
|
313 | + } elseif ( ! class_exists('CI_Model', FALSE)) |
|
318 | 314 | { |
319 | 315 | require_once(BASEPATH.'core'.DIRECTORY_SEPARATOR.'Model.php'); |
320 | 316 | } |
@@ -471,8 +467,7 @@ discard block |
||
471 | 467 | require_once($driver_path); |
472 | 468 | $class = 'CI_DB_'.$db->dbdriver.'_'.$db->subdriver.'_forge'; |
473 | 469 | } |
474 | - } |
|
475 | - else |
|
470 | + } else |
|
476 | 471 | { |
477 | 472 | $class = 'CI_DB_'.$db->dbdriver.'_forge'; |
478 | 473 | } |
@@ -761,16 +756,14 @@ discard block |
||
761 | 756 | if (is_int($key)) |
762 | 757 | { |
763 | 758 | $this->driver($value, $params); |
764 | - } |
|
765 | - else |
|
759 | + } else |
|
766 | 760 | { |
767 | 761 | $this->driver($key, $params, $value); |
768 | 762 | } |
769 | 763 | } |
770 | 764 | |
771 | 765 | return $this; |
772 | - } |
|
773 | - elseif (empty($library)) |
|
766 | + } elseif (empty($library)) |
|
774 | 767 | { |
775 | 768 | return FALSE; |
776 | 769 | } |
@@ -869,8 +862,7 @@ discard block |
||
869 | 862 | array_shift($this->_ci_helper_paths); |
870 | 863 | array_shift($this->_ci_view_paths); |
871 | 864 | array_pop($config->_config_paths); |
872 | - } |
|
873 | - else |
|
865 | + } else |
|
874 | 866 | { |
875 | 867 | $path = rtrim($path, '/').'/'; |
876 | 868 | foreach (array('_ci_library_paths', '_ci_model_paths', '_ci_helper_paths') as $var) |
@@ -934,8 +926,7 @@ discard block |
||
934 | 926 | { |
935 | 927 | $_ci_x = explode('/', $_ci_path); |
936 | 928 | $_ci_file = end($_ci_x); |
937 | - } |
|
938 | - else |
|
929 | + } else |
|
939 | 930 | { |
940 | 931 | $_ci_ext = pathinfo($_ci_view, PATHINFO_EXTENSION); |
941 | 932 | $_ci_file = ($_ci_ext === '') ? $_ci_view.'.php' : $_ci_view; |
@@ -1002,8 +993,7 @@ discard block |
||
1002 | 993 | if ( ! is_php('5.4') && ! ini_get('short_open_tag') && config_item('rewrite_short_tags') === TRUE) |
1003 | 994 | { |
1004 | 995 | echo eval('?>'.preg_replace('/;*\s*\?>/', '; ?>', str_replace('<?=', '<?php echo ', file_get_contents($_ci_path)))); |
1005 | - } |
|
1006 | - else |
|
996 | + } else |
|
1007 | 997 | { |
1008 | 998 | include($_ci_path); // include() vs include_once() allows for multiple views with the same name |
1009 | 999 | } |
@@ -1030,8 +1020,7 @@ discard block |
||
1030 | 1020 | if (ob_get_level() > $this->_ci_ob_level + 1) |
1031 | 1021 | { |
1032 | 1022 | ob_end_flush(); |
1033 | - } |
|
1034 | - else |
|
1023 | + } else |
|
1035 | 1024 | { |
1036 | 1025 | $_ci_CI->output->append_output(ob_get_contents()); |
1037 | 1026 | @ob_end_clean(); |
@@ -1071,8 +1060,7 @@ discard block |
||
1071 | 1060 | |
1072 | 1061 | // Get the filename from the path |
1073 | 1062 | $class = substr($class, $last_slash); |
1074 | - } |
|
1075 | - else |
|
1063 | + } else |
|
1076 | 1064 | { |
1077 | 1065 | $subdir = ''; |
1078 | 1066 | } |
@@ -1210,8 +1198,7 @@ discard block |
||
1210 | 1198 | if (file_exists(TESTPATH.'_ci_phpunit_test/replacing/libraries/'.$file_path.$library_name.'.php')) |
1211 | 1199 | { |
1212 | 1200 | include_once(TESTPATH.'_ci_phpunit_test/replacing/libraries/'.$file_path.$library_name.'.php'); |
1213 | - } |
|
1214 | - else |
|
1201 | + } else |
|
1215 | 1202 | { |
1216 | 1203 | include_once(BASEPATH.'libraries/'.$file_path.$library_name.'.php'); |
1217 | 1204 | } |
@@ -1227,8 +1214,7 @@ discard block |
||
1227 | 1214 | { |
1228 | 1215 | $prefix = config_item('subclass_prefix'); |
1229 | 1216 | break; |
1230 | - } |
|
1231 | - else |
|
1217 | + } else |
|
1232 | 1218 | { |
1233 | 1219 | log_message('debug', $path.' exists, but does not declare '.$subclass); |
1234 | 1220 | } |
@@ -1277,8 +1263,7 @@ discard block |
||
1277 | 1263 | { |
1278 | 1264 | include($path.'config/'.strtolower($class).'.php'); |
1279 | 1265 | $found = TRUE; |
1280 | - } |
|
1281 | - elseif (file_exists($path.'config/'.ucfirst(strtolower($class)).'.php')) |
|
1266 | + } elseif (file_exists($path.'config/'.ucfirst(strtolower($class)).'.php')) |
|
1282 | 1267 | { |
1283 | 1268 | include($path.'config/'.ucfirst(strtolower($class)).'.php'); |
1284 | 1269 | $found = TRUE; |
@@ -1288,8 +1273,7 @@ discard block |
||
1288 | 1273 | { |
1289 | 1274 | include($path.'config/'.ENVIRONMENT.'/'.strtolower($class).'.php'); |
1290 | 1275 | $found = TRUE; |
1291 | - } |
|
1292 | - elseif (file_exists($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php')) |
|
1276 | + } elseif (file_exists($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php')) |
|
1293 | 1277 | { |
1294 | 1278 | include($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php'); |
1295 | 1279 | $found = TRUE; |
@@ -200,16 +200,14 @@ discard block |
||
200 | 200 | if (empty($library)) |
201 | 201 | { |
202 | 202 | return $this; |
203 | - } |
|
204 | - elseif (is_array($library)) |
|
203 | + } elseif (is_array($library)) |
|
205 | 204 | { |
206 | 205 | foreach ($library as $key => $value) |
207 | 206 | { |
208 | 207 | if (is_int($key)) |
209 | 208 | { |
210 | 209 | $this->library($value, $params); |
211 | - } |
|
212 | - else |
|
210 | + } else |
|
213 | 211 | { |
214 | 212 | $this->library($key, $params, $value); |
215 | 213 | } |
@@ -246,8 +244,7 @@ discard block |
||
246 | 244 | if (empty($model)) |
247 | 245 | { |
248 | 246 | return $this; |
249 | - } |
|
250 | - elseif (is_array($model)) |
|
247 | + } elseif (is_array($model)) |
|
251 | 248 | { |
252 | 249 | foreach ($model as $key => $value) |
253 | 250 | { |
@@ -313,8 +310,7 @@ discard block |
||
313 | 310 | { |
314 | 311 | throw new RuntimeException($app_path."Model.php exists, but doesn't declare class CI_Model"); |
315 | 312 | } |
316 | - } |
|
317 | - elseif ( ! class_exists('CI_Model', FALSE)) |
|
313 | + } elseif ( ! class_exists('CI_Model', FALSE)) |
|
318 | 314 | { |
319 | 315 | require_once(BASEPATH.'core'.DIRECTORY_SEPARATOR.'Model.php'); |
320 | 316 | } |
@@ -471,8 +467,7 @@ discard block |
||
471 | 467 | require_once($driver_path); |
472 | 468 | $class = 'CI_DB_'.$db->dbdriver.'_'.$db->subdriver.'_forge'; |
473 | 469 | } |
474 | - } |
|
475 | - else |
|
470 | + } else |
|
476 | 471 | { |
477 | 472 | $class = 'CI_DB_'.$db->dbdriver.'_forge'; |
478 | 473 | } |
@@ -761,16 +756,14 @@ discard block |
||
761 | 756 | if (is_int($key)) |
762 | 757 | { |
763 | 758 | $this->driver($value, $params); |
764 | - } |
|
765 | - else |
|
759 | + } else |
|
766 | 760 | { |
767 | 761 | $this->driver($key, $params, $value); |
768 | 762 | } |
769 | 763 | } |
770 | 764 | |
771 | 765 | return $this; |
772 | - } |
|
773 | - elseif (empty($library)) |
|
766 | + } elseif (empty($library)) |
|
774 | 767 | { |
775 | 768 | return FALSE; |
776 | 769 | } |
@@ -869,8 +862,7 @@ discard block |
||
869 | 862 | array_shift($this->_ci_helper_paths); |
870 | 863 | array_shift($this->_ci_view_paths); |
871 | 864 | array_pop($config->_config_paths); |
872 | - } |
|
873 | - else |
|
865 | + } else |
|
874 | 866 | { |
875 | 867 | $path = rtrim($path, '/').'/'; |
876 | 868 | foreach (array('_ci_library_paths', '_ci_model_paths', '_ci_helper_paths') as $var) |
@@ -934,8 +926,7 @@ discard block |
||
934 | 926 | { |
935 | 927 | $_ci_x = explode('/', $_ci_path); |
936 | 928 | $_ci_file = end($_ci_x); |
937 | - } |
|
938 | - else |
|
929 | + } else |
|
939 | 930 | { |
940 | 931 | $_ci_ext = pathinfo($_ci_view, PATHINFO_EXTENSION); |
941 | 932 | $_ci_file = ($_ci_ext === '') ? $_ci_view.'.php' : $_ci_view; |
@@ -1002,8 +993,7 @@ discard block |
||
1002 | 993 | if ( ! is_php('5.4') && ! ini_get('short_open_tag') && config_item('rewrite_short_tags') === TRUE) |
1003 | 994 | { |
1004 | 995 | echo eval('?>'.preg_replace('/;*\s*\?>/', '; ?>', str_replace('<?=', '<?php echo ', file_get_contents($_ci_path)))); |
1005 | - } |
|
1006 | - else |
|
996 | + } else |
|
1007 | 997 | { |
1008 | 998 | include($_ci_path); // include() vs include_once() allows for multiple views with the same name |
1009 | 999 | } |
@@ -1030,8 +1020,7 @@ discard block |
||
1030 | 1020 | if (ob_get_level() > $this->_ci_ob_level + 1) |
1031 | 1021 | { |
1032 | 1022 | ob_end_flush(); |
1033 | - } |
|
1034 | - else |
|
1023 | + } else |
|
1035 | 1024 | { |
1036 | 1025 | $_ci_CI->output->append_output(ob_get_contents()); |
1037 | 1026 | @ob_end_clean(); |
@@ -1071,8 +1060,7 @@ discard block |
||
1071 | 1060 | |
1072 | 1061 | // Get the filename from the path |
1073 | 1062 | $class = substr($class, $last_slash); |
1074 | - } |
|
1075 | - else |
|
1063 | + } else |
|
1076 | 1064 | { |
1077 | 1065 | $subdir = ''; |
1078 | 1066 | } |
@@ -1210,8 +1198,7 @@ discard block |
||
1210 | 1198 | if (file_exists(TESTPATH.'_ci_phpunit_test/replacing/libraries/'.$file_path.$library_name.'.php')) |
1211 | 1199 | { |
1212 | 1200 | include_once(TESTPATH.'_ci_phpunit_test/replacing/libraries/'.$file_path.$library_name.'.php'); |
1213 | - } |
|
1214 | - else |
|
1201 | + } else |
|
1215 | 1202 | { |
1216 | 1203 | include_once(BASEPATH.'libraries/'.$file_path.$library_name.'.php'); |
1217 | 1204 | } |
@@ -1227,8 +1214,7 @@ discard block |
||
1227 | 1214 | { |
1228 | 1215 | $prefix = config_item('subclass_prefix'); |
1229 | 1216 | break; |
1230 | - } |
|
1231 | - else |
|
1217 | + } else |
|
1232 | 1218 | { |
1233 | 1219 | log_message('debug', $path.' exists, but does not declare '.$subclass); |
1234 | 1220 | } |
@@ -1277,8 +1263,7 @@ discard block |
||
1277 | 1263 | { |
1278 | 1264 | include($path.'config/'.strtolower($class).'.php'); |
1279 | 1265 | $found = TRUE; |
1280 | - } |
|
1281 | - elseif (file_exists($path.'config/'.ucfirst(strtolower($class)).'.php')) |
|
1266 | + } elseif (file_exists($path.'config/'.ucfirst(strtolower($class)).'.php')) |
|
1282 | 1267 | { |
1283 | 1268 | include($path.'config/'.ucfirst(strtolower($class)).'.php'); |
1284 | 1269 | $found = TRUE; |
@@ -1288,8 +1273,7 @@ discard block |
||
1288 | 1273 | { |
1289 | 1274 | include($path.'config/'.ENVIRONMENT.'/'.strtolower($class).'.php'); |
1290 | 1275 | $found = TRUE; |
1291 | - } |
|
1292 | - elseif (file_exists($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php')) |
|
1276 | + } elseif (file_exists($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php')) |
|
1293 | 1277 | { |
1294 | 1278 | include($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php'); |
1295 | 1279 | $found = TRUE; |
@@ -52,71 +52,71 @@ |
||
52 | 52 | */ |
53 | 53 | final class TestSuiteProvider |
54 | 54 | { |
55 | - /** |
|
56 | - * phpunit configuration file |
|
57 | - * |
|
58 | - * @var string |
|
59 | - */ |
|
60 | - private static $file; |
|
55 | + /** |
|
56 | + * phpunit configuration file |
|
57 | + * |
|
58 | + * @var string |
|
59 | + */ |
|
60 | + private static $file; |
|
61 | 61 | |
62 | - /** |
|
63 | - * constructor |
|
64 | - */ |
|
65 | - private function __construct() {} |
|
62 | + /** |
|
63 | + * constructor |
|
64 | + */ |
|
65 | + private function __construct() {} |
|
66 | 66 | |
67 | - /** |
|
68 | - * set the phpunit configuration file |
|
69 | - * |
|
70 | - * @param string $file the path or filename of the phunit configuration file |
|
71 | - */ |
|
72 | - public static function setConfigurationFile($file) |
|
73 | - { |
|
74 | - static::$file = $file; |
|
75 | - } |
|
67 | + /** |
|
68 | + * set the phpunit configuration file |
|
69 | + * |
|
70 | + * @param string $file the path or filename of the phunit configuration file |
|
71 | + */ |
|
72 | + public static function setConfigurationFile($file) |
|
73 | + { |
|
74 | + static::$file = $file; |
|
75 | + } |
|
76 | 76 | |
77 | - /** |
|
78 | - * get the phpunit test suite instance |
|
79 | - * |
|
80 | - * @return PHPUnit_Framework_TestSuite returns the phpunit test suite instance |
|
81 | - * @throws FileNotFoundException if the file is not found |
|
82 | - */ |
|
83 | - public static function suite() |
|
84 | - { |
|
85 | - $file = static::checkConfigurationFile( |
|
86 | - static::getConfigurationFile() |
|
87 | - ); |
|
77 | + /** |
|
78 | + * get the phpunit test suite instance |
|
79 | + * |
|
80 | + * @return PHPUnit_Framework_TestSuite returns the phpunit test suite instance |
|
81 | + * @throws FileNotFoundException if the file is not found |
|
82 | + */ |
|
83 | + public static function suite() |
|
84 | + { |
|
85 | + $file = static::checkConfigurationFile( |
|
86 | + static::getConfigurationFile() |
|
87 | + ); |
|
88 | 88 | |
89 | - return PHPUnit_Util_Configuration::getInstance($file) |
|
90 | - ->getTestSuiteConfiguration(); |
|
91 | - } |
|
89 | + return PHPUnit_Util_Configuration::getInstance($file) |
|
90 | + ->getTestSuiteConfiguration(); |
|
91 | + } |
|
92 | 92 | |
93 | - /** |
|
94 | - * get the phpunit configuration file |
|
95 | - * |
|
96 | - * @return string |
|
97 | - */ |
|
98 | - private static function getConfigurationFile() |
|
99 | - { |
|
100 | - static::$file = isset(static::$file) |
|
101 | - ? static::$file |
|
102 | - : TESTPATH.'phpunit.xml'; |
|
93 | + /** |
|
94 | + * get the phpunit configuration file |
|
95 | + * |
|
96 | + * @return string |
|
97 | + */ |
|
98 | + private static function getConfigurationFile() |
|
99 | + { |
|
100 | + static::$file = isset(static::$file) |
|
101 | + ? static::$file |
|
102 | + : TESTPATH.'phpunit.xml'; |
|
103 | 103 | |
104 | - return static::$file; |
|
105 | - } |
|
104 | + return static::$file; |
|
105 | + } |
|
106 | 106 | |
107 | - /** |
|
108 | - * check the given file |
|
109 | - * |
|
110 | - * @param string $file file to check |
|
111 | - * @return string returns the file if it is valid |
|
112 | - * @throws FileNotFoundException if the file is not found |
|
113 | - */ |
|
114 | - private static function checkConfigurationFile($file) |
|
115 | - { |
|
116 | - if (!file_exists($file)) { |
|
117 | - throw new \RuntimeException("The requested phpunit configuration was not found at $file"); |
|
118 | - } |
|
107 | + /** |
|
108 | + * check the given file |
|
109 | + * |
|
110 | + * @param string $file file to check |
|
111 | + * @return string returns the file if it is valid |
|
112 | + * @throws FileNotFoundException if the file is not found |
|
113 | + */ |
|
114 | + private static function checkConfigurationFile($file) |
|
115 | + { |
|
116 | + if (!file_exists($file)) { |
|
117 | + throw new \RuntimeException("The requested phpunit configuration was not found at $file"); |
|
118 | + } |
|
119 | 119 | |
120 | - return $file; |
|
121 | - } |
|
120 | + return $file; |
|
121 | + } |
|
122 | 122 | } |
@@ -9,10 +9,10 @@ discard block |
||
9 | 9 | */ |
10 | 10 | |
11 | 11 | // Autoloader for ci-phpunit-test |
12 | -require __DIR__ . '/CIPHPUnitTestAutoloader.php'; |
|
13 | -require __DIR__ . '/CIPHPUnitTestFileCache.php'; |
|
12 | +require __DIR__.'/CIPHPUnitTestAutoloader.php'; |
|
13 | +require __DIR__.'/CIPHPUnitTestFileCache.php'; |
|
14 | 14 | $cache = new CIPHPUnitTestFileCache( |
15 | - __DIR__ . '/tmp/cache/autoload.php' |
|
15 | + __DIR__.'/tmp/cache/autoload.php' |
|
16 | 16 | ); |
17 | 17 | $autoload_dirs = CIPHPUnitTest::getAutoloadDirs(); |
18 | 18 | $autoloader = new CIPHPUnitTestAutoloader($cache, $autoload_dirs); |
@@ -20,5 +20,5 @@ discard block |
||
20 | 20 | |
21 | 21 | // Register CodeIgniter's tests/mocks/autoloader.php |
22 | 22 | define('SYSTEM_PATH', BASEPATH); |
23 | -require TESTPATH .'mocks/autoloader.php'; |
|
23 | +require TESTPATH.'mocks/autoloader.php'; |
|
24 | 24 | spl_autoload_register('autoload'); |
@@ -33,30 +33,30 @@ discard block |
||
33 | 33 | $cwd_backup = getcwd(); |
34 | 34 | |
35 | 35 | // Load autoloader for ci-phpunit-test |
36 | - require __DIR__ . '/autoloader.php'; |
|
36 | + require __DIR__.'/autoloader.php'; |
|
37 | 37 | |
38 | - require TESTPATH . 'TestCase.php'; |
|
38 | + require TESTPATH.'TestCase.php'; |
|
39 | 39 | |
40 | - $db_test_case_file = TESTPATH . 'DbTestCase.php'; |
|
40 | + $db_test_case_file = TESTPATH.'DbTestCase.php'; |
|
41 | 41 | if (is_readable($db_test_case_file)) |
42 | 42 | { |
43 | 43 | require $db_test_case_file; |
44 | 44 | } |
45 | 45 | |
46 | 46 | // Replace a few Common functions |
47 | - require __DIR__ . '/replacing/core/Common.php'; |
|
48 | - require BASEPATH . 'core/Common.php'; |
|
47 | + require __DIR__.'/replacing/core/Common.php'; |
|
48 | + require BASEPATH.'core/Common.php'; |
|
49 | 49 | |
50 | 50 | // Workaround for missing CodeIgniter's error handler |
51 | 51 | // See https://github.com/kenjis/ci-phpunit-test/issues/37 |
52 | 52 | set_error_handler('_error_handler'); |
53 | 53 | |
54 | 54 | // Load new functions of CIPHPUnitTest |
55 | - require __DIR__ . '/functions.php'; |
|
55 | + require __DIR__.'/functions.php'; |
|
56 | 56 | // Load ci-phpunit-test CI_Loader |
57 | - require __DIR__ . '/replacing/core/Loader.php'; |
|
57 | + require __DIR__.'/replacing/core/Loader.php'; |
|
58 | 58 | // Load ci-phpunit-test CI_Input |
59 | - require __DIR__ . '/replacing/core/Input.php'; |
|
59 | + require __DIR__.'/replacing/core/Input.php'; |
|
60 | 60 | |
61 | 61 | // Change current directory |
62 | 62 | chdir(FCPATH); |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | * |
69 | 69 | * And away we go... |
70 | 70 | */ |
71 | - require __DIR__ . '/replacing/core/CodeIgniter.php'; |
|
71 | + require __DIR__.'/replacing/core/CodeIgniter.php'; |
|
72 | 72 | |
73 | 73 | self::replaceHelpers(); |
74 | 74 | |
75 | 75 | // Create CodeIgniter instance |
76 | - if (! self::wiredesignzHmvcInstalled()) |
|
76 | + if ( ! self::wiredesignzHmvcInstalled()) |
|
77 | 77 | { |
78 | 78 | new CI_Controller(); |
79 | 79 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | |
95 | 95 | public static function createCodeIgniterInstance() |
96 | 96 | { |
97 | - if (! self::wiredesignzHmvcInstalled()) |
|
97 | + if ( ! self::wiredesignzHmvcInstalled()) |
|
98 | 98 | { |
99 | 99 | new CI_Controller(); |
100 | 100 | } |
@@ -123,11 +123,11 @@ discard block |
||
123 | 123 | protected static function replaceLoader() |
124 | 124 | { |
125 | 125 | $my_loader_file = |
126 | - APPPATH . 'core/' . config_item('subclass_prefix') . 'Loader.php'; |
|
126 | + APPPATH.'core/'.config_item('subclass_prefix').'Loader.php'; |
|
127 | 127 | |
128 | 128 | if (file_exists($my_loader_file)) |
129 | 129 | { |
130 | - self::$loader_class = config_item('subclass_prefix') . 'Loader'; |
|
130 | + self::$loader_class = config_item('subclass_prefix').'Loader'; |
|
131 | 131 | if ( ! class_exists(self::$loader_class)) |
132 | 132 | { |
133 | 133 | require $my_loader_file; |
@@ -146,19 +146,19 @@ discard block |
||
146 | 146 | |
147 | 147 | protected static function loadHelper($helper) |
148 | 148 | { |
149 | - $my_helper_file = APPPATH . 'helpers/' . config_item('subclass_prefix') . $helper . '.php'; |
|
149 | + $my_helper_file = APPPATH.'helpers/'.config_item('subclass_prefix').$helper.'.php'; |
|
150 | 150 | if (file_exists($my_helper_file)) |
151 | 151 | { |
152 | 152 | require $my_helper_file; |
153 | 153 | } |
154 | - require __DIR__ . '/replacing/helpers/' . $helper . '.php'; |
|
154 | + require __DIR__.'/replacing/helpers/'.$helper.'.php'; |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | public static function setPatcherCacheDir($dir = null) |
158 | 158 | { |
159 | 159 | if ($dir === null) |
160 | 160 | { |
161 | - $dir = TESTPATH . '_ci_phpunit_test/tmp/cache'; |
|
161 | + $dir = TESTPATH.'_ci_phpunit_test/tmp/cache'; |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | MonkeyPatchManager::setCacheDir( |