@@ -250,6 +250,9 @@ |
||
| 250 | 250 | return $this->createAndCallController($class, $method, $params); |
| 251 | 251 | } |
| 252 | 252 | |
| 253 | + /** |
|
| 254 | + * @param string $hook |
|
| 255 | + */ |
|
| 253 | 256 | protected function callHook($hook) |
| 254 | 257 | { |
| 255 | 258 | if ($this->enableHooks) |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | public function enableHooks() |
| 117 | 117 | { |
| 118 | 118 | $this->enableHooks = true; |
| 119 | - $this->hooks =& load_class('Hooks', 'core'); |
|
| 119 | + $this->hooks = & load_class('Hooks', 'core'); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | { |
| 163 | 163 | set_status_header($e->getCode()); |
| 164 | 164 | } |
| 165 | - $CI =& get_instance(); |
|
| 165 | + $CI = & get_instance(); |
|
| 166 | 166 | $CI->output->_status['redirect'] = $e->getMessage(); |
| 167 | 167 | } |
| 168 | 168 | // show_404() |
@@ -224,17 +224,17 @@ discard block |
||
| 224 | 224 | $this->setRawInputStream($request_params); |
| 225 | 225 | |
| 226 | 226 | // 404 checking |
| 227 | - if (! class_exists($class) || ! method_exists($class, $method)) |
|
| 227 | + if ( ! class_exists($class) || ! method_exists($class, $method)) |
|
| 228 | 228 | { |
| 229 | 229 | // If 404, CodeIgniter instance is not created yet. So create it here |
| 230 | 230 | // Because we need CI->output->_status to store info |
| 231 | - $CI =& get_instance(); |
|
| 231 | + $CI = & get_instance(); |
|
| 232 | 232 | if ($CI instanceof CIPHPUnitTestNullCodeIgniter) |
| 233 | 233 | { |
| 234 | 234 | CIPHPUnitTest::createCodeIgniterInstance(); |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | - show_404($class.'::'.$method . '() is not found'); |
|
| 237 | + show_404($class.'::'.$method.'() is not found'); |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | $params = $argv; |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | { |
| 297 | 297 | if (is_string($string)) |
| 298 | 298 | { |
| 299 | - $INPUT =& load_class('Input', 'core'); |
|
| 299 | + $INPUT = & load_class('Input', 'core'); |
|
| 300 | 300 | CIPHPUnitTestReflection::setPrivateProperty( |
| 301 | 301 | $INPUT, |
| 302 | 302 | '_raw_input_stream', |
@@ -326,12 +326,12 @@ discard block |
||
| 326 | 326 | new CI(); |
| 327 | 327 | } |
| 328 | 328 | $controller = new $class; |
| 329 | - $CI =& get_instance(); |
|
| 329 | + $CI = & get_instance(); |
|
| 330 | 330 | |
| 331 | 331 | // Set CodeIgniter instance to TestCase |
| 332 | 332 | $this->testCase->setCI($CI); |
| 333 | 333 | |
| 334 | - if (! isset($CI->output->_status)) |
|
| 334 | + if ( ! isset($CI->output->_status)) |
|
| 335 | 335 | { |
| 336 | 336 | // Prevent overwriting, if already set in the $class::__construct() |
| 337 | 337 | // Set default response code 200 |
@@ -377,8 +377,8 @@ discard block |
||
| 377 | 377 | */ |
| 378 | 378 | public function getStatus() |
| 379 | 379 | { |
| 380 | - $CI =& get_instance(); |
|
| 381 | - if (! isset($CI->output->_status)) |
|
| 380 | + $CI = & get_instance(); |
|
| 381 | + if ( ! isset($CI->output->_status)) |
|
| 382 | 382 | { |
| 383 | 383 | throw new LogicException('Status code is not set. You must call $this->request() first'); |
| 384 | 384 | } |
@@ -10,9 +10,9 @@ |
||
| 10 | 10 | |
| 11 | 11 | class CIPHPUnitTestRequest |
| 12 | 12 | { |
| 13 | - /** |
|
| 14 | - * @var TestCase |
|
| 15 | - */ |
|
| 13 | + /** |
|
| 14 | + * @var TestCase |
|
| 15 | + */ |
|
| 16 | 16 | protected $testCase; |
| 17 | 17 | |
| 18 | 18 | /** |
@@ -154,8 +154,7 @@ discard block |
||
| 154 | 154 | ); |
| 155 | 155 | $this->testCase->disableStrictErrorCheck(); |
| 156 | 156 | return $ret; |
| 157 | - } |
|
| 158 | - else |
|
| 157 | + } else |
|
| 159 | 158 | { |
| 160 | 159 | $ret = $this->requestUri($http_method, $argv, $params); |
| 161 | 160 | $this->testCase->disableStrictErrorCheck(); |
@@ -169,8 +168,7 @@ discard block |
||
| 169 | 168 | if ($e->getCode() === 0) |
| 170 | 169 | { |
| 171 | 170 | set_status_header(200); |
| 172 | - } |
|
| 173 | - else |
|
| 171 | + } else |
|
| 174 | 172 | { |
| 175 | 173 | set_status_header($e->getCode()); |
| 176 | 174 | } |
@@ -63,6 +63,9 @@ discard block |
||
| 63 | 63 | return self::$cache_dir; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | + /** |
|
| 67 | + * @param string $path |
|
| 68 | + */ |
|
| 66 | 69 | public static function getSrcCacheFilePath($path) |
| 67 | 70 | { |
| 68 | 71 | $len = strlen(self::$project_root); |
@@ -158,6 +161,9 @@ discard block |
||
| 158 | 161 | ); |
| 159 | 162 | } |
| 160 | 163 | |
| 164 | + /** |
|
| 165 | + * @param string $filename |
|
| 166 | + */ |
|
| 161 | 167 | protected static function writeTmpConfFile($filename, array $list) |
| 162 | 168 | { |
| 163 | 169 | $contents = implode("\n", $list); |
@@ -194,6 +200,9 @@ discard block |
||
| 194 | 200 | ); |
| 195 | 201 | } |
| 196 | 202 | |
| 203 | + /** |
|
| 204 | + * @param string $filename |
|
| 205 | + */ |
|
| 197 | 206 | protected static function getTmpConfFile($filename) |
| 198 | 207 | { |
| 199 | 208 | if (is_readable(self::$$filename)) |
@@ -11,7 +11,6 @@ |
||
| 11 | 11 | namespace Kenjis\MonkeyPatch; |
| 12 | 12 | |
| 13 | 13 | use RuntimeException; |
| 14 | - |
|
| 15 | 14 | use RecursiveIteratorIterator; |
| 16 | 15 | use RecursiveDirectoryIterator; |
| 17 | 16 | |
@@ -45,17 +45,17 @@ discard block |
||
| 45 | 45 | throw new LogicException("No such directory: $dir"); |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - self::$src_cache_dir = self::$cache_dir . '/src'; |
|
| 48 | + self::$src_cache_dir = self::$cache_dir.'/src'; |
|
| 49 | 49 | self::$tmp_function_whitelist_file = |
| 50 | - self::$cache_dir . '/conf/func_whiltelist.php'; |
|
| 50 | + self::$cache_dir.'/conf/func_whiltelist.php'; |
|
| 51 | 51 | self::$tmp_function_blacklist_file = |
| 52 | - self::$cache_dir . '/conf/func_blacklist.php'; |
|
| 52 | + self::$cache_dir.'/conf/func_blacklist.php'; |
|
| 53 | 53 | self::$tmp_patcher_list_file = |
| 54 | - self::$cache_dir . '/conf/patcher_list.php'; |
|
| 54 | + self::$cache_dir.'/conf/patcher_list.php'; |
|
| 55 | 55 | self::$tmp_include_paths_file = |
| 56 | - self::$cache_dir . '/conf/include_paths.php'; |
|
| 56 | + self::$cache_dir.'/conf/include_paths.php'; |
|
| 57 | 57 | self::$tmp_exclude_paths_file = |
| 58 | - self::$cache_dir . '/conf/exclude_paths.php'; |
|
| 58 | + self::$cache_dir.'/conf/exclude_paths.php'; |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | public static function getCacheDir() |
@@ -73,16 +73,16 @@ discard block |
||
| 73 | 73 | return false; |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - return self::$src_cache_dir . '/' . $relative_path; |
|
| 76 | + return self::$src_cache_dir.'/'.$relative_path; |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | protected static function createDir($dir) |
| 80 | 80 | { |
| 81 | - if (! is_dir($dir)) |
|
| 81 | + if ( ! is_dir($dir)) |
|
| 82 | 82 | { |
| 83 | - if (! @mkdir($dir, 0777, true)) |
|
| 83 | + if ( ! @mkdir($dir, 0777, true)) |
|
| 84 | 84 | { |
| 85 | - throw new RuntimeException('Failed to create folder: ' . $dir); |
|
| 85 | + throw new RuntimeException('Failed to create folder: '.$dir); |
|
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | } |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | public static function appendTmpFunctionBlacklist($function) |
| 155 | 155 | { |
| 156 | 156 | file_put_contents( |
| 157 | - self::getTmpFunctionBlacklistFile(), $function . "\n", FILE_APPEND |
|
| 157 | + self::getTmpFunctionBlacklistFile(), $function."\n", FILE_APPEND |
|
| 158 | 158 | ); |
| 159 | 159 | } |
| 160 | 160 | |
@@ -234,20 +234,20 @@ discard block |
||
| 234 | 234 | { |
| 235 | 235 | $cache = self::getSrcCacheFilePath($orig_file); |
| 236 | 236 | @unlink($cache); |
| 237 | - MonkeyPatchManager::log('remove_src_cache: ' . $cache); |
|
| 237 | + MonkeyPatchManager::log('remove_src_cache: '.$cache); |
|
| 238 | 238 | return $cache; |
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | public static function clearSrcCache() |
| 242 | 242 | { |
| 243 | 243 | self::recursiveUnlink(self::$src_cache_dir); |
| 244 | - MonkeyPatchManager::log('clear_src_cache: cleared ' . self::$src_cache_dir); |
|
| 244 | + MonkeyPatchManager::log('clear_src_cache: cleared '.self::$src_cache_dir); |
|
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | public static function clearCache() |
| 248 | 248 | { |
| 249 | 249 | self::recursiveUnlink(self::$cache_dir); |
| 250 | - MonkeyPatchManager::log('clear_cache: cleared ' . self::$cache_dir); |
|
| 250 | + MonkeyPatchManager::log('clear_cache: cleared '.self::$cache_dir); |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | /** |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | */ |
| 258 | 258 | protected static function recursiveUnlink($dir) |
| 259 | 259 | { |
| 260 | - if (! is_dir($dir)) |
|
| 260 | + if ( ! is_dir($dir)) |
|
| 261 | 261 | { |
| 262 | 262 | return; |
| 263 | 263 | } |
@@ -251,10 +251,10 @@ |
||
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | /** |
| 254 | - * Recursive Unlink |
|
| 255 | - * |
|
| 256 | - * @param string $dir |
|
| 257 | - */ |
|
| 254 | + * Recursive Unlink |
|
| 255 | + * |
|
| 256 | + * @param string $dir |
|
| 257 | + */ |
|
| 258 | 258 | protected static function recursiveUnlink($dir) |
| 259 | 259 | { |
| 260 | 260 | if (! is_dir($dir)) |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | * |
| 22 | 22 | * @param string $function function name |
| 23 | 23 | * @param mixed $return_value return value |
| 24 | - * @param string $class_name class::method to apply this patch |
|
| 24 | + * @param string $class_method class::method to apply this patch |
|
| 25 | 25 | */ |
| 26 | 26 | public static function patchFunction($function, $return_value, $class_method = null) |
| 27 | 27 | { |
@@ -55,6 +55,9 @@ discard block |
||
| 55 | 55 | PatchManager::clear(); |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | + /** |
|
| 59 | + * @param string $class_method |
|
| 60 | + */ |
|
| 58 | 61 | protected static function getClassname($class_method) |
| 59 | 62 | { |
| 60 | 63 | if (strpos($class_method, '::') === false) |
@@ -60,8 +60,7 @@ |
||
| 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 | } |
@@ -37,12 +37,12 @@ |
||
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /** |
| 40 | - * Patch on constant |
|
| 41 | - * |
|
| 42 | - * @param type $constant |
|
| 43 | - * @param type $value |
|
| 44 | - * @param type $class_method |
|
| 45 | - */ |
|
| 40 | + * Patch on constant |
|
| 41 | + * |
|
| 42 | + * @param type $constant |
|
| 43 | + * @param type $value |
|
| 44 | + * @param type $class_method |
|
| 45 | + */ |
|
| 46 | 46 | public static function patchConstant($constant, $value, $class_method = null) |
| 47 | 47 | { |
| 48 | 48 | ConstProxy::patch($constant, $value, $class_method); |
@@ -136,6 +136,11 @@ discard block |
||
| 136 | 136 | return $_is_loaded; |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | +/** |
|
| 140 | + * @param boolean $return |
|
| 141 | + * |
|
| 142 | + * @return boolean |
|
| 143 | + */ |
|
| 139 | 144 | function is_cli($return = null) |
| 140 | 145 | { |
| 141 | 146 | static $_return = TRUE; |
@@ -148,6 +153,9 @@ discard block |
||
| 148 | 153 | return $_return; |
| 149 | 154 | } |
| 150 | 155 | |
| 156 | +/** |
|
| 157 | + * @param string $message |
|
| 158 | + */ |
|
| 151 | 159 | function show_error($message, $status_code = 500, $heading = 'An Error Was Encountered') |
| 152 | 160 | { |
| 153 | 161 | $status_code = abs($status_code); |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | |
| 264 | 264 | // Save status code in Output object |
| 265 | 265 | // added by ci-phpunit-test |
| 266 | - $CI =& get_instance(); |
|
| 266 | + $CI = & get_instance(); |
|
| 267 | 267 | $output = $CI->output; |
| 268 | 268 | $output->_status = [ |
| 269 | 269 | 'code' => $code, |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | if (empty($_config)) |
| 377 | 377 | { |
| 378 | 378 | // references cannot be directly assigned to static variables, so we use an array |
| 379 | - $_config[0] =& get_config(); |
|
| 379 | + $_config[0] = & get_config(); |
|
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | return isset($_config[0][$item]) ? $_config[0][$item] : NULL; |
@@ -160,8 +160,7 @@ discard block |
||
| 160 | 160 | $exit_status = $status_code + 9; // 9 is EXIT__AUTO_MIN |
| 161 | 161 | |
| 162 | 162 | $status_code = 500; |
| 163 | - } |
|
| 164 | - else |
|
| 163 | + } else |
|
| 165 | 164 | { |
| 166 | 165 | $exit_status = 1; // EXIT_ERROR |
| 167 | 166 | } |
@@ -256,8 +255,7 @@ discard block |
||
| 256 | 255 | if (isset($stati[$code])) |
| 257 | 256 | { |
| 258 | 257 | $text = $stati[$code]; |
| 259 | - } |
|
| 260 | - else |
|
| 258 | + } else |
|
| 261 | 259 | { |
| 262 | 260 | show_error('No status text available. Please check your status code number or supply your own message text.', 500); |
| 263 | 261 | } |
@@ -327,8 +325,7 @@ discard block |
||
| 327 | 325 | if (file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/config.php')) |
| 328 | 326 | { |
| 329 | 327 | require($file_path); |
| 330 | - } |
|
| 331 | - elseif ( ! $found) |
|
| 328 | + } elseif ( ! $found) |
|
| 332 | 329 | { |
| 333 | 330 | set_status_header(503); |
| 334 | 331 | echo 'The configuration file does not exist.'; |
@@ -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 | /* |
@@ -80,8 +80,7 @@ discard block |
||
| 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 |
||
| 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( |
@@ -247,8 +245,7 @@ discard block |
||
| 247 | 245 | if (($_temp = realpath($application_folder)) !== FALSE) |
| 248 | 246 | { |
| 249 | 247 | $application_folder = $_temp; |
| 250 | - } |
|
| 251 | - else |
|
| 248 | + } else |
|
| 252 | 249 | { |
| 253 | 250 | $application_folder = strtr( |
| 254 | 251 | rtrim($application_folder, '/\\'), |
@@ -256,16 +253,14 @@ discard block |
||
| 256 | 253 | DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR |
| 257 | 254 | ); |
| 258 | 255 | } |
| 259 | - } |
|
| 260 | - elseif (is_dir(BASEPATH.$application_folder.DIRECTORY_SEPARATOR)) |
|
| 256 | + } elseif (is_dir(BASEPATH.$application_folder.DIRECTORY_SEPARATOR)) |
|
| 261 | 257 | { |
| 262 | 258 | $application_folder = BASEPATH.strtr( |
| 263 | 259 | trim($application_folder, '/\\'), |
| 264 | 260 | '/\\', |
| 265 | 261 | DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR |
| 266 | 262 | ); |
| 267 | - } |
|
| 268 | - else |
|
| 263 | + } else |
|
| 269 | 264 | { |
| 270 | 265 | header('HTTP/1.1 503 Service Unavailable.', TRUE, 503); |
| 271 | 266 | echo 'Your application folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF; |
@@ -278,14 +273,12 @@ discard block |
||
| 278 | 273 | if ( ! isset($view_folder[0]) && is_dir(APPPATH.'views'.DIRECTORY_SEPARATOR)) |
| 279 | 274 | { |
| 280 | 275 | $view_folder = APPPATH.'views'; |
| 281 | - } |
|
| 282 | - elseif (is_dir($view_folder)) |
|
| 276 | + } elseif (is_dir($view_folder)) |
|
| 283 | 277 | { |
| 284 | 278 | if (($_temp = realpath($view_folder)) !== FALSE) |
| 285 | 279 | { |
| 286 | 280 | $view_folder = $_temp; |
| 287 | - } |
|
| 288 | - else |
|
| 281 | + } else |
|
| 289 | 282 | { |
| 290 | 283 | $view_folder = strtr( |
| 291 | 284 | rtrim($view_folder, '/\\'), |
@@ -293,16 +286,14 @@ discard block |
||
| 293 | 286 | DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR |
| 294 | 287 | ); |
| 295 | 288 | } |
| 296 | - } |
|
| 297 | - elseif (is_dir(APPPATH.$view_folder.DIRECTORY_SEPARATOR)) |
|
| 289 | + } elseif (is_dir(APPPATH.$view_folder.DIRECTORY_SEPARATOR)) |
|
| 298 | 290 | { |
| 299 | 291 | $view_folder = APPPATH.strtr( |
| 300 | 292 | trim($view_folder, '/\\'), |
| 301 | 293 | '/\\', |
| 302 | 294 | DIRECTORY_SEPARATOR.DIRECTORY_SEPARATOR |
| 303 | 295 | ); |
| 304 | - } |
|
| 305 | - else |
|
| 296 | + } else |
|
| 306 | 297 | { |
| 307 | 298 | header('HTTP/1.1 503 Service Unavailable.', TRUE, 503); |
| 308 | 299 | echo 'Your view folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF; |
@@ -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); |
@@ -366,7 +366,7 @@ discard block |
||
| 366 | 366 | define('TESTPATH', APPPATH.'tests'.DIRECTORY_SEPARATOR); |
| 367 | 367 | */ |
| 368 | 368 | |
| 369 | -require __DIR__ . '/_ci_phpunit_test/CIPHPUnitTest.php'; |
|
| 369 | +require __DIR__.'/_ci_phpunit_test/CIPHPUnitTest.php'; |
|
| 370 | 370 | |
| 371 | 371 | CIPHPUnitTest::init(); |
| 372 | 372 | // Or you can set directories for autoloading |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | { |
| 70 | 70 | if (in_array($class, $this->alias)) |
| 71 | 71 | { |
| 72 | - $dir = __DIR__ . '/alias'; |
|
| 72 | + $dir = __DIR__.'/alias'; |
|
| 73 | 73 | $this->loadClassFile($dir, $class); |
| 74 | 74 | } |
| 75 | 75 | } |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | } |
| 89 | 89 | else |
| 90 | 90 | { |
| 91 | - $dir = __DIR__ . '/exceptions'; |
|
| 91 | + $dir = __DIR__.'/exceptions'; |
|
| 92 | 92 | $this->loadClassFile($dir, $class); |
| 93 | 93 | } |
| 94 | 94 | } |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | protected function loadClassFile($dir, $class) |
| 131 | 131 | { |
| 132 | - $class_file = $dir . '/' . $class . '.php'; |
|
| 132 | + $class_file = $dir.'/'.$class.'.php'; |
|
| 133 | 133 | if (file_exists($class_file)) |
| 134 | 134 | { |
| 135 | 135 | require $class_file; |
@@ -44,8 +44,7 @@ discard block |
||
| 44 | 44 | APPPATH.'modules', |
| 45 | 45 | APPPATH.'hooks', |
| 46 | 46 | ]; |
| 47 | - } |
|
| 48 | - else |
|
| 47 | + } else |
|
| 49 | 48 | { |
| 50 | 49 | $this->dirs = $dirs; |
| 51 | 50 | } |
@@ -86,8 +85,7 @@ discard block |
||
| 86 | 85 | { |
| 87 | 86 | $dir = __DIR__; |
| 88 | 87 | $this->loadClassFile($dir, $class); |
| 89 | - } |
|
| 90 | - else |
|
| 88 | + } else |
|
| 91 | 89 | { |
| 92 | 90 | $dir = __DIR__ . '/exceptions'; |
| 93 | 91 | $this->loadClassFile($dir, $class); |
@@ -152,8 +150,7 @@ discard block |
||
| 152 | 150 | { |
| 153 | 151 | require $filename; |
| 154 | 152 | return true; |
| 155 | - } |
|
| 156 | - else |
|
| 153 | + } else |
|
| 157 | 154 | { |
| 158 | 155 | unset($this->cache[$class]); |
| 159 | 156 | } |
@@ -24,18 +24,18 @@ |
||
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | $dir = dirname($this->file); |
| 27 | - if (! is_dir($dir)) |
|
| 27 | + if ( ! is_dir($dir)) |
|
| 28 | 28 | { |
| 29 | 29 | if (@mkdir($dir, 0777, true) === false) |
| 30 | 30 | { |
| 31 | - throw new RuntimeException('Failed to create folder: ' . $dir); |
|
| 31 | + throw new RuntimeException('Failed to create folder: '.$dir); |
|
| 32 | 32 | } |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | if (file_put_contents($this->file, '') === false) |
| 36 | 36 | { |
| 37 | 37 | throw new RuntimeException( |
| 38 | - 'Failed to write to cache file: ' . $this->file |
|
| 38 | + 'Failed to write to cache file: '.$this->file |
|
| 39 | 39 | ); |
| 40 | 40 | } |
| 41 | 41 | } |
@@ -67,8 +67,7 @@ |
||
| 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 | } |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | $ref_method->setAccessible(true); |
| 22 | 22 | $obj = (gettype($obj) === 'object') ? $obj : null; |
| 23 | 23 | |
| 24 | - return function () use ($obj, $ref_method) { |
|
| 24 | + return function() use ($obj, $ref_method) { |
|
| 25 | 25 | $args = func_get_args(); |
| 26 | 26 | return $ref_method->invokeArgs($obj, $args); |
| 27 | 27 | }; |
@@ -29,16 +29,14 @@ |
||
| 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'; |
@@ -19,8 +19,8 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | public function getRoute() |
| 21 | 21 | { |
| 22 | - $RTR =& load_class('Router', 'core'); |
|
| 23 | - $URI =& load_class('URI', 'core'); |
|
| 22 | + $RTR = & load_class('Router', 'core'); |
|
| 23 | + $URI = & load_class('URI', 'core'); |
|
| 24 | 24 | |
| 25 | 25 | $e404 = FALSE; |
| 26 | 26 | $class = ucfirst($RTR->class); |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | { |
| 58 | 58 | // If 404, CodeIgniter instance is not created yet. So create it here. |
| 59 | 59 | // Because we need CI->output->_status |
| 60 | - $CI =& get_instance(); |
|
| 60 | + $CI = & get_instance(); |
|
| 61 | 61 | if ($CI instanceof CIPHPUnitTestNullCodeIgniter) |
| 62 | 62 | { |
| 63 | 63 | CIPHPUnitTest::createCodeIgniterInstance(); |