@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | PHPUnit_Framework_TestCase::assertEquals( |
| 55 | 55 | $expected_times, |
| 56 | 56 | $actual_times, |
| 57 | - $class_method . '() expected to be not invoked, but invoked ' . $actual_times . ' times.' |
|
| 57 | + $class_method.'() expected to be not invoked, but invoked '.$actual_times.' times.' |
|
| 58 | 58 | ); |
| 59 | 59 | } |
| 60 | 60 | elseif ($expected_times === '+') |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | PHPUnit_Framework_TestCase::assertGreaterThanOrEqual( |
| 63 | 63 | 1, |
| 64 | 64 | $actual_times, |
| 65 | - $class_method . '() expected to be invoked at least one time, but invoked ' . $actual_times . ' times.' |
|
| 65 | + $class_method.'() expected to be invoked at least one time, but invoked '.$actual_times.' times.' |
|
| 66 | 66 | ); |
| 67 | 67 | } |
| 68 | 68 | else |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | PHPUnit_Framework_TestCase::assertEquals( |
| 71 | 71 | $expected_times, |
| 72 | 72 | $actual_times, |
| 73 | - $class_method . '() expected to be invoked ' . $expected_times . ' times, but invoked ' . $actual_times . ' times.' |
|
| 73 | + $class_method.'() expected to be invoked '.$expected_times.' times, but invoked '.$actual_times.' times.' |
|
| 74 | 74 | ); |
| 75 | 75 | } |
| 76 | 76 | } |
@@ -31,12 +31,10 @@ discard block |
||
| 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 |
||
| 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, |
@@ -18,11 +18,11 @@ |
||
| 18 | 18 | |
| 19 | 19 | if ($class === null) |
| 20 | 20 | { |
| 21 | - $message = 'exit() called in ' . $method . '() function'; |
|
| 21 | + $message = 'exit() called in '.$method.'() function'; |
|
| 22 | 22 | } |
| 23 | 23 | else |
| 24 | 24 | { |
| 25 | - $message = 'exit() called in ' . $class . '::' . $method . '()'; |
|
| 25 | + $message = 'exit() called in '.$class.'::'.$method.'()'; |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | $exception_name = Kenjis\MonkeyPatch\MonkeyPatchManager::getExitExceptionClassname(); |
@@ -19,8 +19,7 @@ |
||
| 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 | } |
@@ -105,7 +105,7 @@ |
||
| 105 | 105 | ob_end_clean(); |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - throw new CIPHPUnitTestRedirectException('Redirect to ' . $uri, $code); |
|
| 108 | + throw new CIPHPUnitTestRedirectException('Redirect to '.$uri, $code); |
|
| 109 | 109 | } |
| 110 | 110 | } |
| 111 | 111 | } |
@@ -34,16 +34,14 @@ discard block |
||
| 34 | 34 | if ($method === 'auto' && isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== FALSE) |
| 35 | 35 | { |
| 36 | 36 | $method = 'refresh'; |
| 37 | - } |
|
| 38 | - elseif ($method !== 'refresh' && (empty($code) OR ! is_numeric($code))) |
|
| 37 | + } elseif ($method !== 'refresh' && (empty($code) OR ! is_numeric($code))) |
|
| 39 | 38 | { |
| 40 | 39 | if (isset($_SERVER['SERVER_PROTOCOL'], $_SERVER['REQUEST_METHOD']) && $_SERVER['SERVER_PROTOCOL'] === 'HTTP/1.1') |
| 41 | 40 | { |
| 42 | 41 | $code = ($_SERVER['REQUEST_METHOD'] !== 'GET') |
| 43 | 42 | ? 303 // reference: http://en.wikipedia.org/wiki/Post/Redirect/Get |
| 44 | 43 | : 307; |
| 45 | - } |
|
| 46 | - else |
|
| 44 | + } else |
|
| 47 | 45 | { |
| 48 | 46 | $code = 302; |
| 49 | 47 | } |
@@ -68,8 +66,7 @@ discard block |
||
| 68 | 66 | if ( ! is_testing_env()) |
| 69 | 67 | { |
| 70 | 68 | exit; |
| 71 | - } |
|
| 72 | - else |
|
| 69 | + } else |
|
| 73 | 70 | { |
| 74 | 71 | while (ob_get_level() > 1) |
| 75 | 72 | { |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | public function test_APPPATH() |
| 26 | 26 | { |
| 27 | 27 | $actual = realpath(APPPATH); |
| 28 | - $expected = realpath(__DIR__ . '/../..'); |
|
| 28 | + $expected = realpath(__DIR__.'/../..'); |
|
| 29 | 29 | $this->assertEquals( |
| 30 | 30 | $expected, |
| 31 | 31 | $actual, |
@@ -102,7 +102,7 @@ |
||
| 102 | 102 | elseif (strpos($class, 'CI_DB') === 0) |
| 103 | 103 | { |
| 104 | 104 | $dir = SYSTEM_PATH.'database'.DIRECTORY_SEPARATOR; |
| 105 | - $file = $dir.str_replace(array('CI_DB','active_record'), array('DB', 'active_rec'), $subclass).'.php'; |
|
| 105 | + $file = $dir.str_replace(array('CI_DB', 'active_record'), array('DB', 'active_rec'), $subclass).'.php'; |
|
| 106 | 106 | } |
| 107 | 107 | else |
| 108 | 108 | { |
@@ -63,8 +63,7 @@ discard block |
||
| 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 |
||
| 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 | } |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | * Start the timer... tick tock tick tock... |
| 186 | 186 | * ------------------------------------------------------ |
| 187 | 187 | */ |
| 188 | - $BM =& load_class('Benchmark', 'core'); |
|
| 188 | + $BM = & load_class('Benchmark', 'core'); |
|
| 189 | 189 | CIPHPUnitTestSuperGlobal::set_Global('BM', $BM); |
| 190 | 190 | $BM->mark('total_execution_time_start'); |
| 191 | 191 | $BM->mark('loading_time:_base_classes_start'); |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | * Instantiate the hooks class |
| 196 | 196 | * ------------------------------------------------------ |
| 197 | 197 | */ |
| 198 | - $EXT =& load_class('Hooks', 'core'); |
|
| 198 | + $EXT = & load_class('Hooks', 'core'); |
|
| 199 | 199 | CIPHPUnitTestSuperGlobal::set_Global('EXT', $EXT); |
| 200 | 200 | |
| 201 | 201 | /* |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | * depending on another class that uses it. |
| 216 | 216 | * |
| 217 | 217 | */ |
| 218 | - $CFG =& load_class('Config', 'core'); |
|
| 218 | + $CFG = & load_class('Config', 'core'); |
|
| 219 | 219 | CIPHPUnitTestSuperGlobal::set_Global('CFG', $CFG); |
| 220 | 220 | |
| 221 | 221 | // Do we have any manually set config items in the index.php file? |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | * Instantiate the UTF-8 class |
| 295 | 295 | * ------------------------------------------------------ |
| 296 | 296 | */ |
| 297 | - $UNI =& load_class('Utf8', 'core'); |
|
| 297 | + $UNI = & load_class('Utf8', 'core'); |
|
| 298 | 298 | CIPHPUnitTestSuperGlobal::set_Global('UNI', $UNI); |
| 299 | 299 | |
| 300 | 300 | /* |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | * Instantiate the URI class |
| 303 | 303 | * ------------------------------------------------------ |
| 304 | 304 | */ |
| 305 | - $URI =& load_class('URI', 'core'); |
|
| 305 | + $URI = & load_class('URI', 'core'); |
|
| 306 | 306 | CIPHPUnitTestSuperGlobal::set_Global('URI', $URI); |
| 307 | 307 | |
| 308 | 308 | /* |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | * Instantiate the routing class and set the routing |
| 311 | 311 | * ------------------------------------------------------ |
| 312 | 312 | */ |
| 313 | - $RTR =& load_class('Router', 'core', isset($routing) ? $routing : NULL); |
|
| 313 | + $RTR = & load_class('Router', 'core', isset($routing) ? $routing : NULL); |
|
| 314 | 314 | CIPHPUnitTestSuperGlobal::set_Global('RTR', $RTR); |
| 315 | 315 | |
| 316 | 316 | /* |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | * Instantiate the output class |
| 319 | 319 | * ------------------------------------------------------ |
| 320 | 320 | */ |
| 321 | - $OUT =& load_class('Output', 'core'); |
|
| 321 | + $OUT = & load_class('Output', 'core'); |
|
| 322 | 322 | CIPHPUnitTestSuperGlobal::set_Global('OUT', $OUT); |
| 323 | 323 | |
| 324 | 324 | /* |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | * Load the security class for xss and csrf support |
| 337 | 337 | * ----------------------------------------------------- |
| 338 | 338 | */ |
| 339 | - $SEC =& load_class('Security', 'core'); |
|
| 339 | + $SEC = & load_class('Security', 'core'); |
|
| 340 | 340 | CIPHPUnitTestSuperGlobal::set_Global('SEC', $SEC); |
| 341 | 341 | |
| 342 | 342 | /* |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | * Load the Input class and sanitize globals |
| 345 | 345 | * ------------------------------------------------------ |
| 346 | 346 | */ |
| 347 | - $IN =& load_class('Input', 'core'); |
|
| 347 | + $IN = & load_class('Input', 'core'); |
|
| 348 | 348 | CIPHPUnitTestSuperGlobal::set_Global('IN', $IN); |
| 349 | 349 | |
| 350 | 350 | /* |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | * Load the Language class |
| 353 | 353 | * ------------------------------------------------------ |
| 354 | 354 | */ |
| 355 | - $LANG =& load_class('Lang', 'core'); |
|
| 355 | + $LANG = & load_class('Lang', 'core'); |
|
| 356 | 356 | CIPHPUnitTestSuperGlobal::set_Global('LANG', $LANG); |
| 357 | 357 | |
| 358 | 358 | /* |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | */ |
| 376 | 376 | function &get_instance() |
| 377 | 377 | { |
| 378 | - if (! CIPHPUnitTest::wiredesignzHmvcInstalled()) |
|
| 378 | + if ( ! CIPHPUnitTest::wiredesignzHmvcInstalled()) |
|
| 379 | 379 | { |
| 380 | 380 | return CI_Controller::get_instance(); |
| 381 | 381 | } |
@@ -169,12 +169,10 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 | } |
@@ -38,12 +38,12 @@ |
||
| 38 | 38 | $real_path = realpath($path); |
| 39 | 39 | if ($real_path === FALSE) |
| 40 | 40 | { |
| 41 | - throw new RuntimeException($path . ' does not exist?'); |
|
| 41 | + throw new RuntimeException($path.' does not exist?'); |
|
| 42 | 42 | } |
| 43 | 43 | if (is_dir($real_path)) |
| 44 | 44 | { |
| 45 | 45 | // Must use DIRECTORY_SEPARATOR for Windows |
| 46 | - $real_path = $real_path . DIRECTORY_SEPARATOR; |
|
| 46 | + $real_path = $real_path.DIRECTORY_SEPARATOR; |
|
| 47 | 47 | } |
| 48 | 48 | $new_paths[] = $excluded ? '-'.$real_path : $real_path; |
| 49 | 49 | } |
@@ -42,9 +42,9 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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; |
@@ -76,8 +76,7 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 187 | 184 | ) |
| 188 | 185 | { |
| 189 | 186 | $key = $normalized_name; |
| 190 | - } |
|
| 191 | - else |
|
| 187 | + } else |
|
| 192 | 188 | { |
| 193 | 189 | $key = 'HTTP_' . $normalized_name; |
| 194 | 190 | } |
@@ -293,8 +293,8 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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; |
@@ -331,19 +331,16 @@ discard block |
||
| 331 | 331 | if ($reflection->hasMethod('set_'.$key)) |
| 332 | 332 | { |
| 333 | 333 | $this->{'set_'.$key}($config[$key]); |
| 334 | - } |
|
| 335 | - else |
|
| 334 | + } else |
|
| 336 | 335 | { |
| 337 | 336 | $this->$key = $config[$key]; |
| 338 | 337 | } |
| 339 | - } |
|
| 340 | - else |
|
| 338 | + } else |
|
| 341 | 339 | { |
| 342 | 340 | $this->$key = $defaults[$key]; |
| 343 | 341 | } |
| 344 | 342 | } |
| 345 | - } |
|
| 346 | - else |
|
| 343 | + } else |
|
| 347 | 344 | { |
| 348 | 345 | foreach ($config as $key => &$value) |
| 349 | 346 | { |
@@ -352,8 +349,7 @@ discard block |
||
| 352 | 349 | if ($reflection->hasMethod('set_'.$key)) |
| 353 | 350 | { |
| 354 | 351 | $this->{'set_'.$key}($value); |
| 355 | - } |
|
| 356 | - else |
|
| 352 | + } else |
|
| 357 | 353 | { |
| 358 | 354 | $this->$key = $value; |
| 359 | 355 | } |
@@ -415,9 +411,11 @@ discard block |
||
| 415 | 411 | } |
| 416 | 412 | |
| 417 | 413 | // Was the file able to be uploaded? If not, determine the reason why. |
| 418 | - if ( ! file_exists($_file['tmp_name'])) // modified by ci-phpunit-test |
|
| 414 | + if ( ! file_exists($_file['tmp_name'])) { |
|
| 415 | + // modified by ci-phpunit-test |
|
| 419 | 416 | { |
| 420 | 417 | $error = isset($_file['error']) ? $_file['error'] : 4; |
| 418 | + } |
|
| 421 | 419 | |
| 422 | 420 | switch ($error) |
| 423 | 421 | { |
@@ -482,8 +480,7 @@ discard block |
||
| 482 | 480 | if (strpos($this->_file_name_override, '.') === FALSE) |
| 483 | 481 | { |
| 484 | 482 | $this->file_name .= $this->file_ext; |
| 485 | - } |
|
| 486 | - else |
|
| 483 | + } else |
|
| 487 | 484 | { |
| 488 | 485 | // An extension was provided, let's have it! |
| 489 | 486 | $this->file_ext = $this->get_extension($this->_file_name_override); |
@@ -881,8 +878,7 @@ discard block |
||
| 881 | 878 | if (in_array($this->file_type, $png_mimes)) |
| 882 | 879 | { |
| 883 | 880 | $this->file_type = 'image/png'; |
| 884 | - } |
|
| 885 | - elseif (in_array($this->file_type, $jpeg_mimes)) |
|
| 881 | + } elseif (in_array($this->file_type, $jpeg_mimes)) |
|
| 886 | 882 | { |
| 887 | 883 | $this->file_type = 'image/jpeg'; |
| 888 | 884 | } |
@@ -1148,9 +1144,12 @@ discard block |
||
| 1148 | 1144 | |
| 1149 | 1145 | if (function_exists('getimagesize') && @getimagesize($file) !== FALSE) |
| 1150 | 1146 | { |
| 1151 | - if (($file = @fopen($file, 'rb')) === FALSE) // "b" to force binary |
|
| 1147 | + if (($file = @fopen($file, 'rb')) === FALSE) { |
|
| 1148 | + // "b" to force binary |
|
| 1152 | 1149 | { |
| 1153 | - return FALSE; // Couldn't open the file, return FALSE |
|
| 1150 | + return FALSE; |
|
| 1151 | + } |
|
| 1152 | + // Couldn't open the file, return FALSE |
|
| 1154 | 1153 | } |
| 1155 | 1154 | |
| 1156 | 1155 | $opening_bytes = fread($file, 256); |
@@ -1269,9 +1268,11 @@ discard block |
||
| 1269 | 1268 | if (function_exists('finfo_file')) |
| 1270 | 1269 | { |
| 1271 | 1270 | $finfo = @finfo_open(FILEINFO_MIME); |
| 1272 | - 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 |
|
| 1271 | + if (is_resource($finfo)) { |
|
| 1272 | + // It is possible that a FALSE value is returned, if there is no magic MIME database file found on the system |
|
| 1273 | 1273 | { |
| 1274 | 1274 | $mime = @finfo_file($finfo, $file['tmp_name']); |
| 1275 | + } |
|
| 1275 | 1276 | finfo_close($finfo); |
| 1276 | 1277 | |
| 1277 | 1278 | /* According to the comments section of the PHP manual page, |
@@ -1356,10 +1357,12 @@ discard block |
||
| 1356 | 1357 | if (function_exists('mime_content_type')) |
| 1357 | 1358 | { |
| 1358 | 1359 | $this->file_type = @mime_content_type($file['tmp_name']); |
| 1359 | - if (strlen($this->file_type) > 0) // It's possible that mime_content_type() returns FALSE or an empty string |
|
| 1360 | + if (strlen($this->file_type) > 0) { |
|
| 1361 | + // It's possible that mime_content_type() returns FALSE or an empty string |
|
| 1360 | 1362 | { |
| 1361 | 1363 | return; |
| 1362 | 1364 | } |
| 1365 | + } |
|
| 1363 | 1366 | } |
| 1364 | 1367 | |
| 1365 | 1368 | $this->file_type = $file['type']; |