@@ -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) |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | public function enableHooks() |
| 96 | 96 | { |
| 97 | 97 | $this->enableHooks = true; |
| 98 | - $this->hooks =& load_class('Hooks', 'core'); |
|
| 98 | + $this->hooks = & load_class('Hooks', 'core'); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | /** |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | { |
| 142 | 142 | set_status_header($e->getCode()); |
| 143 | 143 | } |
| 144 | - $CI =& get_instance(); |
|
| 144 | + $CI = & get_instance(); |
|
| 145 | 145 | $CI->output->_status['redirect'] = $e->getMessage(); |
| 146 | 146 | } |
| 147 | 147 | // show_404() |
@@ -197,17 +197,17 @@ discard block |
||
| 197 | 197 | $this->setRawInputStream($request_params); |
| 198 | 198 | |
| 199 | 199 | // 404 checking |
| 200 | - if (! class_exists($class) || ! method_exists($class, $method)) |
|
| 200 | + if ( ! class_exists($class) || ! method_exists($class, $method)) |
|
| 201 | 201 | { |
| 202 | 202 | // If 404, CodeIgniter instance is not created yet. So create it here |
| 203 | 203 | // Because we need CI->output->_status to store info |
| 204 | - $CI =& get_instance(); |
|
| 204 | + $CI = & get_instance(); |
|
| 205 | 205 | if ($CI === null) |
| 206 | 206 | { |
| 207 | 207 | new CI_Controller(); |
| 208 | 208 | } |
| 209 | 209 | |
| 210 | - show_404($class.'::'.$method . '() is not found'); |
|
| 210 | + show_404($class.'::'.$method.'() is not found'); |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | $params = $argv; |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | { |
| 267 | 267 | if (is_string($string)) |
| 268 | 268 | { |
| 269 | - $INPUT =& load_class('Input', 'core'); |
|
| 269 | + $INPUT = & load_class('Input', 'core'); |
|
| 270 | 270 | CIPHPUnitTestReflection::setPrivateProperty( |
| 271 | 271 | $INPUT, |
| 272 | 272 | '_raw_input_stream', |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | |
| 291 | 291 | // Create controller |
| 292 | 292 | $controller = new $class; |
| 293 | - $CI =& get_instance(); |
|
| 293 | + $CI = & get_instance(); |
|
| 294 | 294 | |
| 295 | 295 | // Set CodeIgniter instance to TestCase |
| 296 | 296 | $this->testCase->setCI($CI); |
@@ -330,8 +330,8 @@ discard block |
||
| 330 | 330 | */ |
| 331 | 331 | public function getStatus() |
| 332 | 332 | { |
| 333 | - $CI =& get_instance(); |
|
| 334 | - if (! isset($CI->output->_status)) |
|
| 333 | + $CI = & get_instance(); |
|
| 334 | + if ( ! isset($CI->output->_status)) |
|
| 335 | 335 | { |
| 336 | 336 | throw new LogicException('Status code is not set. You must call $this->request() first'); |
| 337 | 337 | } |
@@ -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)) |
@@ -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 | } |
@@ -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) |
@@ -32,6 +32,9 @@ discard block |
||
| 32 | 32 | 'MethodPatcher', |
| 33 | 33 | ]; |
| 34 | 34 | |
| 35 | + /** |
|
| 36 | + * @param string $message |
|
| 37 | + */ |
|
| 35 | 38 | public static function log($message) |
| 36 | 39 | { |
| 37 | 40 | if (! self::$debug) |
@@ -276,6 +279,9 @@ discard block |
||
| 276 | 279 | self::$load_patchers = true; |
| 277 | 280 | } |
| 278 | 281 | |
| 282 | + /** |
|
| 283 | + * @param string $source |
|
| 284 | + */ |
|
| 279 | 285 | protected static function execPatchers($source) |
| 280 | 286 | { |
| 281 | 287 | $patched = false; |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | public static function log($message) |
| 36 | 36 | { |
| 37 | - if (! self::$debug) |
|
| 37 | + if ( ! self::$debug) |
|
| 38 | 38 | { |
| 39 | 39 | return; |
| 40 | 40 | } |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | } |
| 65 | 65 | if (self::$debug) |
| 66 | 66 | { |
| 67 | - self::$log_file = __DIR__ . '/debug.log'; |
|
| 67 | + self::$log_file = __DIR__.'/debug.log'; |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | if (isset($config['root_dir'])) |
@@ -74,16 +74,16 @@ discard block |
||
| 74 | 74 | else |
| 75 | 75 | { |
| 76 | 76 | // APPPATH is constant in CodeIgniter |
| 77 | - Cache::setProjectRootDir(APPPATH . '../'); |
|
| 77 | + Cache::setProjectRootDir(APPPATH.'../'); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - if (! isset($config['cache_dir'])) |
|
| 80 | + if ( ! isset($config['cache_dir'])) |
|
| 81 | 81 | { |
| 82 | 82 | throw new LogicException('You have to set "cache_dir"'); |
| 83 | 83 | } |
| 84 | 84 | self::setCacheDir($config['cache_dir']); |
| 85 | 85 | |
| 86 | - if (! isset($config['include_paths'])) |
|
| 86 | + if ( ! isset($config['include_paths'])) |
|
| 87 | 87 | { |
| 88 | 88 | throw new LogicException('You have to set "include_paths"'); |
| 89 | 89 | } |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | // Updated? |
| 132 | 132 | if ($cached !== $current) |
| 133 | 133 | { |
| 134 | - MonkeyPatchManager::log('clear_src_cache: from ' . __METHOD__); |
|
| 134 | + MonkeyPatchManager::log('clear_src_cache: from '.__METHOD__); |
|
| 135 | 135 | Cache::clearSrcCache(); |
| 136 | 136 | Cache::writeTmpIncludePaths($current); |
| 137 | 137 | } |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | // Updated? |
| 143 | 143 | if ($cached !== $current) |
| 144 | 144 | { |
| 145 | - MonkeyPatchManager::log('clear_src_cache: from ' . __METHOD__); |
|
| 145 | + MonkeyPatchManager::log('clear_src_cache: from '.__METHOD__); |
|
| 146 | 146 | Cache::clearSrcCache(); |
| 147 | 147 | Cache::writeTmpExcludePaths($current); |
| 148 | 148 | } |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | // Updated? |
| 156 | 156 | if ($cached !== self::$patcher_list) |
| 157 | 157 | { |
| 158 | - MonkeyPatchManager::log('clear_src_cache: from ' . __METHOD__); |
|
| 158 | + MonkeyPatchManager::log('clear_src_cache: from '.__METHOD__); |
|
| 159 | 159 | Cache::clearSrcCache(); |
| 160 | 160 | Cache::writeTmpPatcherList(self::$patcher_list); |
| 161 | 161 | } |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | // Updated? |
| 170 | 170 | if ($cached !== $current) |
| 171 | 171 | { |
| 172 | - MonkeyPatchManager::log('clear_src_cache: from ' . __METHOD__); |
|
| 172 | + MonkeyPatchManager::log('clear_src_cache: from '.__METHOD__); |
|
| 173 | 173 | Cache::clearSrcCache(); |
| 174 | 174 | Cache::writeTmpFunctionWhitelist($current); |
| 175 | 175 | } |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | */ |
| 232 | 232 | public static function patch($path) |
| 233 | 233 | { |
| 234 | - if (! is_readable($path)) |
|
| 234 | + if ( ! is_readable($path)) |
|
| 235 | 235 | { |
| 236 | 236 | throw new LogicException("Can't read '$path'"); |
| 237 | 237 | } |
@@ -239,17 +239,17 @@ discard block |
||
| 239 | 239 | // Check cache file |
| 240 | 240 | if ($cache_file = Cache::getValidSrcCachePath($path)) |
| 241 | 241 | { |
| 242 | - self::log('cache_hit: ' . $path); |
|
| 242 | + self::log('cache_hit: '.$path); |
|
| 243 | 243 | return fopen($cache_file, 'r'); |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | - self::log('cache_miss: ' . $path); |
|
| 246 | + self::log('cache_miss: '.$path); |
|
| 247 | 247 | $source = file_get_contents($path); |
| 248 | 248 | |
| 249 | 249 | list($new_source, $patched) = self::execPatchers($source); |
| 250 | 250 | |
| 251 | 251 | // Write to cache file |
| 252 | - self::log('write_cache: ' . $path); |
|
| 252 | + self::log('write_cache: '.$path); |
|
| 253 | 253 | Cache::writeSrcCacheFile($path, $new_source); |
| 254 | 254 | |
| 255 | 255 | $resource = fopen('php://memory', 'rb+'); |
@@ -265,12 +265,12 @@ discard block |
||
| 265 | 265 | return; |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | - require __DIR__ . '/Patcher/AbstractPatcher.php'; |
|
| 269 | - require __DIR__ . '/Patcher/Backtrace.php'; |
|
| 268 | + require __DIR__.'/Patcher/AbstractPatcher.php'; |
|
| 269 | + require __DIR__.'/Patcher/Backtrace.php'; |
|
| 270 | 270 | |
| 271 | 271 | foreach (self::$patcher_list as $classname) |
| 272 | 272 | { |
| 273 | - require __DIR__ . '/Patcher/' . $classname . '.php'; |
|
| 273 | + require __DIR__.'/Patcher/'.$classname.'.php'; |
|
| 274 | 274 | } |
| 275 | 275 | |
| 276 | 276 | self::$load_patchers = true; |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | $patched = false; |
| 282 | 282 | foreach (self::$patcher_list as $classname) |
| 283 | 283 | { |
| 284 | - $classname = 'Kenjis\MonkeyPatch\Patcher\\' . $classname; |
|
| 284 | + $classname = 'Kenjis\MonkeyPatch\Patcher\\'.$classname; |
|
| 285 | 285 | $patcher = new $classname; |
| 286 | 286 | list($source, $patched_this) = $patcher->patch($source); |
| 287 | 287 | $patched = $patched || $patched_this; |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | * |
| 38 | 38 | * @param string $function function name |
| 39 | 39 | * @param mixed $return_value return value or callable |
| 40 | - * @param string $class_name class::method to apply this patch |
|
| 40 | + * @param string $class_method class::method to apply this patch |
|
| 41 | 41 | * |
| 42 | 42 | * @throws LogicException |
| 43 | 43 | */ |
@@ -86,6 +86,9 @@ discard block |
||
| 86 | 86 | InvocationVerifier::verify(self::$expected_invocations, self::$invocations); |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | + /** |
|
| 90 | + * @param string $function |
|
| 91 | + */ |
|
| 89 | 92 | protected static function logInvocation($function, $arguments) |
| 90 | 93 | { |
| 91 | 94 | if (MonkeyPatchManager::$debug) |
@@ -111,6 +114,9 @@ discard block |
||
| 111 | 114 | } |
| 112 | 115 | } |
| 113 | 116 | |
| 117 | + /** |
|
| 118 | + * @param string $function |
|
| 119 | + */ |
|
| 114 | 120 | protected static function checkCalledMethod($function) |
| 115 | 121 | { |
| 116 | 122 | $trace = debug_backtrace(); |
@@ -184,6 +190,9 @@ discard block |
||
| 184 | 190 | return call_user_func_array($function, $arguments); |
| 185 | 191 | } |
| 186 | 192 | |
| 193 | + /** |
|
| 194 | + * @param string $function |
|
| 195 | + */ |
|
| 187 | 196 | protected static function checkPassedByReference($function) |
| 188 | 197 | { |
| 189 | 198 | $ref_func = new ReflectionFunction($function); |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | self::outputMessage($msg); |
| 52 | 52 | throw new LogicException($msg); |
| 53 | 53 | } |
| 54 | - if (! FunctionPatcher::isWhitelisted($function)) |
|
| 54 | + if ( ! FunctionPatcher::isWhitelisted($function)) |
|
| 55 | 55 | { |
| 56 | 56 | $msg = "<red>Can't patch on '$function'. It is not in whitelist. If you want to patch it, please add it to 'functions_to_patch' in 'tests/Bootstrap.php'. But note that there are some limitations. See <https://github.com/kenjis/ci-phpunit-test/blob/master/docs/HowToWriteTests.md#patching-functions> for details.</red>"; |
| 57 | 57 | self::outputMessage($msg); |
@@ -97,16 +97,16 @@ discard block |
||
| 97 | 97 | $line = $info['line']; |
| 98 | 98 | $method = isset($info['class_method']) ? $info['class_method'] : $info['function']; |
| 99 | 99 | |
| 100 | - $log_args = function () use ($arguments) { |
|
| 100 | + $log_args = function() use ($arguments) { |
|
| 101 | 101 | $output = ''; |
| 102 | 102 | foreach ($arguments as $arg) { |
| 103 | - $output .= var_export($arg, true) . ', '; |
|
| 103 | + $output .= var_export($arg, true).', '; |
|
| 104 | 104 | } |
| 105 | 105 | $output = rtrim($output, ', '); |
| 106 | 106 | return $output; |
| 107 | 107 | }; |
| 108 | 108 | MonkeyPatchManager::log( |
| 109 | - 'invoke_func: ' . $function . '(' . $log_args() . ') on line ' . $line . ' in ' . $file . ' by ' . $method . '()' |
|
| 109 | + 'invoke_func: '.$function.'('.$log_args().') on line '.$line.' in '.$file.' by '.$method.'()' |
|
| 110 | 110 | ); |
| 111 | 111 | } |
| 112 | 112 | } |
@@ -148,10 +148,10 @@ discard block |
||
| 148 | 148 | |
| 149 | 149 | if (isset(self::$patches_to_apply[$function])) |
| 150 | 150 | { |
| 151 | - if (! self::checkCalledMethod($function)) |
|
| 151 | + if ( ! self::checkCalledMethod($function)) |
|
| 152 | 152 | { |
| 153 | 153 | MonkeyPatchManager::log( |
| 154 | - 'invoke_func: ' . $function . '() not patched (out of scope)' |
|
| 154 | + 'invoke_func: '.$function.'() not patched (out of scope)' |
|
| 155 | 155 | ); |
| 156 | 156 | self::checkPassedByReference($function); |
| 157 | 157 | return call_user_func_array($function, $arguments); |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | |
| 161 | 161 | if (array_key_exists($function, self::$patches)) |
| 162 | 162 | { |
| 163 | - MonkeyPatchManager::log('invoke_func: ' . $function . '() patched'); |
|
| 163 | + MonkeyPatchManager::log('invoke_func: '.$function.'() patched'); |
|
| 164 | 164 | |
| 165 | 165 | if (is_callable(self::$patches[$function])) |
| 166 | 166 | { |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | MonkeyPatchManager::log( |
| 181 | - 'invoke_func: ' . $function . '() not patched (no patch)' |
|
| 181 | + 'invoke_func: '.$function.'() not patched (no patch)' |
|
| 182 | 182 | ); |
| 183 | 183 | self::checkPassedByReference($function); |
| 184 | 184 | return call_user_func_array($function, $arguments); |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | $msg = str_replace( |
| 232 | 232 | ['<red>', '</red>'], [$red_begin, $red_end], $msg |
| 233 | 233 | ); |
| 234 | - echo $msg . "\n"; |
|
| 234 | + echo $msg."\n"; |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | /** |
@@ -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; |
@@ -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 is needed for @runInSeparateProcess |
| 57 | -if (! defined('ENVIRONMENT')) |
|
| 57 | +if ( ! defined('ENVIRONMENT')) |
|
| 58 | 58 | { |
| 59 | 59 | define('ENVIRONMENT', 'testing'); |
| 60 | 60 | } |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | * Added for CI PHPUnit Test |
| 328 | 328 | * ------------------------------------------------------------------- |
| 329 | 329 | */ |
| 330 | -require __DIR__ . '/_ci_phpunit_test/CIPHPUnitTest.php'; |
|
| 330 | +require __DIR__.'/_ci_phpunit_test/CIPHPUnitTest.php'; |
|
| 331 | 331 | CIPHPUnitTest::init(); |
| 332 | 332 | /* |
| 333 | 333 | * 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; |
@@ -86,7 +86,7 @@ |
||
| 86 | 86 | break; |
| 87 | 87 | default: |
| 88 | 88 | throw new RuntimeException( |
| 89 | - 'Sorry, ' . $count . ' params not implemented yet' |
|
| 89 | + 'Sorry, '.$count.' params not implemented yet' |
|
| 90 | 90 | ); |
| 91 | 91 | } |
| 92 | 92 | } |