@@ -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) |
@@ -129,8 +129,7 @@ discard block |
||
| 129 | 129 | return $this->callControllerMethod( |
| 130 | 130 | $http_method, $argv, $params |
| 131 | 131 | ); |
| 132 | - } |
|
| 133 | - else |
|
| 132 | + } else |
|
| 134 | 133 | { |
| 135 | 134 | return $this->requestUri($http_method, $argv, $params); |
| 136 | 135 | } |
@@ -141,8 +140,7 @@ discard block |
||
| 141 | 140 | if ($e->getCode() === 0) |
| 142 | 141 | { |
| 143 | 142 | set_status_header(200); |
| 144 | - } |
|
| 145 | - else |
|
| 143 | + } else |
|
| 146 | 144 | { |
| 147 | 145 | set_status_header($e->getCode()); |
| 148 | 146 | } |
@@ -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 | } |
@@ -1,12 +1,12 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Part of ci-phpunit-test |
|
| 4 | - * |
|
| 5 | - * @author Kenji Suzuki <https://github.com/kenjis> |
|
| 6 | - * @license MIT License |
|
| 7 | - * @copyright 2015 Kenji Suzuki |
|
| 8 | - * @link https://github.com/kenjis/ci-phpunit-test |
|
| 9 | - */ |
|
| 3 | + * Part of ci-phpunit-test |
|
| 4 | + * |
|
| 5 | + * @author Kenji Suzuki <https://github.com/kenjis> |
|
| 6 | + * @license MIT License |
|
| 7 | + * @copyright 2015 Kenji Suzuki |
|
| 8 | + * @link https://github.com/kenjis/ci-phpunit-test |
|
| 9 | + */ |
|
| 10 | 10 | |
| 11 | 11 | class CategorySeeder extends Seeder { |
| 12 | 12 | |
@@ -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 | } |
@@ -13,7 +13,6 @@ |
||
| 13 | 13 | use PhpParser\Node; |
| 14 | 14 | use PhpParser\Node\Stmt\ClassMethod; |
| 15 | 15 | use PhpParser\NodeVisitorAbstract; |
| 16 | - |
|
| 17 | 16 | use Kenjis\MonkeyPatch\Patcher\MethodPatcher; |
| 18 | 17 | |
| 19 | 18 | class NodeVisitor extends NodeVisitorAbstract |
@@ -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) |
@@ -38,8 +38,7 @@ |
||
| 38 | 38 | { |
| 39 | 39 | $patched = true; |
| 40 | 40 | $new_source = static::generateNewSource($source); |
| 41 | - } |
|
| 42 | - else |
|
| 41 | + } else |
|
| 43 | 42 | { |
| 44 | 43 | $new_source = $source; |
| 45 | 44 | } |
@@ -1,12 +1,12 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Part of ci-phpunit-test |
|
| 4 | - * |
|
| 5 | - * @author Kenji Suzuki <https://github.com/kenjis> |
|
| 6 | - * @license MIT License |
|
| 7 | - * @copyright 2015 Kenji Suzuki |
|
| 8 | - * @link https://github.com/kenjis/ci-phpunit-test |
|
| 9 | - */ |
|
| 3 | + * Part of ci-phpunit-test |
|
| 4 | + * |
|
| 5 | + * @author Kenji Suzuki <https://github.com/kenjis> |
|
| 6 | + * @license MIT License |
|
| 7 | + * @copyright 2015 Kenji Suzuki |
|
| 8 | + * @link https://github.com/kenjis/ci-phpunit-test |
|
| 9 | + */ |
|
| 10 | 10 | |
| 11 | 11 | class CategorySeeder extends Seeder { |
| 12 | 12 | |
@@ -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; |
@@ -38,8 +38,7 @@ |
||
| 38 | 38 | { |
| 39 | 39 | $patched = true; |
| 40 | 40 | $new_source = static::generateNewSource($source); |
| 41 | - } |
|
| 42 | - else |
|
| 41 | + } else |
|
| 43 | 42 | { |
| 44 | 43 | $new_source = $source; |
| 45 | 44 | } |
@@ -11,7 +11,6 @@ |
||
| 11 | 11 | namespace Kenjis\MonkeyPatch; |
| 12 | 12 | |
| 13 | 13 | use LogicException; |
| 14 | -use RuntimeException; |
|
| 15 | 14 | use PhpParser\ParserFactory; |
| 16 | 15 | use Kenjis\MonkeyPatch\Patcher\FunctionPatcher; |
| 17 | 16 | |
@@ -1,12 +1,12 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Part of ci-phpunit-test |
|
| 4 | - * |
|
| 5 | - * @author Kenji Suzuki <https://github.com/kenjis> |
|
| 6 | - * @license MIT License |
|
| 7 | - * @copyright 2015 Kenji Suzuki |
|
| 8 | - * @link https://github.com/kenjis/ci-phpunit-test |
|
| 9 | - */ |
|
| 3 | + * Part of ci-phpunit-test |
|
| 4 | + * |
|
| 5 | + * @author Kenji Suzuki <https://github.com/kenjis> |
|
| 6 | + * @license MIT License |
|
| 7 | + * @copyright 2015 Kenji Suzuki |
|
| 8 | + * @link https://github.com/kenjis/ci-phpunit-test |
|
| 9 | + */ |
|
| 10 | 10 | |
| 11 | 11 | class CategorySeeder extends Seeder { |
| 12 | 12 | |
@@ -21,15 +21,11 @@ |
||
| 21 | 21 | |
| 22 | 22 | namespace Kenjis\MonkeyPatch\Patcher\FunctionPatcher; |
| 23 | 23 | |
| 24 | -use ReflectionFunction; |
|
| 25 | -use ReflectionException; |
|
| 26 | - |
|
| 27 | 24 | use PhpParser\Node; |
| 28 | 25 | use PhpParser\Node\Expr\FuncCall; |
| 29 | 26 | use PhpParser\Node\Name; |
| 30 | 27 | use PhpParser\Node\Name\FullyQualified; |
| 31 | 28 | use PhpParser\NodeVisitorAbstract; |
| 32 | - |
|
| 33 | 29 | use Kenjis\MonkeyPatch\Patcher\FunctionPatcher; |
| 34 | 30 | |
| 35 | 31 | class NodeVisitor extends NodeVisitorAbstract |
@@ -36,17 +36,17 @@ discard block |
||
| 36 | 36 | { |
| 37 | 37 | public function leaveNode(Node $node) |
| 38 | 38 | { |
| 39 | - if (! ($node instanceof FuncCall)) |
|
| 39 | + if ( ! ($node instanceof FuncCall)) |
|
| 40 | 40 | { |
| 41 | 41 | return; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - if (! ($node->name instanceof Name)) |
|
| 44 | + if ( ! ($node->name instanceof Name)) |
|
| 45 | 45 | { |
| 46 | 46 | return; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - if (! $node->name->isUnqualified()) |
|
| 49 | + if ( ! $node->name->isUnqualified()) |
|
| 50 | 50 | { |
| 51 | 51 | return; |
| 52 | 52 | } |
@@ -57,12 +57,12 @@ discard block |
||
| 57 | 57 | ) { |
| 58 | 58 | $replacement = new FullyQualified(array()); |
| 59 | 59 | $replacement->set( |
| 60 | - '\__FuncProxy__::' . (string) $node->name |
|
| 60 | + '\__FuncProxy__::'.(string) $node->name |
|
| 61 | 61 | ); |
| 62 | 62 | |
| 63 | 63 | $pos = $node->getAttribute('startTokenPos'); |
| 64 | 64 | FunctionPatcher::$replacement[$pos] = |
| 65 | - '\__FuncProxy__::' . (string) $node->name; |
|
| 65 | + '\__FuncProxy__::'.(string) $node->name; |
|
| 66 | 66 | |
| 67 | 67 | $node->name = $replacement; |
| 68 | 68 | } |
@@ -1,12 +1,12 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Part of ci-phpunit-test |
|
| 4 | - * |
|
| 5 | - * @author Kenji Suzuki <https://github.com/kenjis> |
|
| 6 | - * @license MIT License |
|
| 7 | - * @copyright 2015 Kenji Suzuki |
|
| 8 | - * @link https://github.com/kenjis/ci-phpunit-test |
|
| 9 | - */ |
|
| 3 | + * Part of ci-phpunit-test |
|
| 4 | + * |
|
| 5 | + * @author Kenji Suzuki <https://github.com/kenjis> |
|
| 6 | + * @license MIT License |
|
| 7 | + * @copyright 2015 Kenji Suzuki |
|
| 8 | + * @link https://github.com/kenjis/ci-phpunit-test |
|
| 9 | + */ |
|
| 10 | 10 | |
| 11 | 11 | class CategorySeeder extends Seeder { |
| 12 | 12 | |
@@ -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 | /** |
@@ -13,7 +13,6 @@ |
||
| 13 | 13 | use PhpParser\Node; |
| 14 | 14 | use PhpParser\Node\Stmt\ClassMethod; |
| 15 | 15 | use PhpParser\NodeVisitorAbstract; |
| 16 | - |
|
| 17 | 16 | use Kenjis\MonkeyPatch\Patcher\MethodPatcher; |
| 18 | 17 | |
| 19 | 18 | class NodeVisitor extends NodeVisitorAbstract |
@@ -1,12 +1,12 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Part of ci-phpunit-test |
|
| 4 | - * |
|
| 5 | - * @author Kenji Suzuki <https://github.com/kenjis> |
|
| 6 | - * @license MIT License |
|
| 7 | - * @copyright 2015 Kenji Suzuki |
|
| 8 | - * @link https://github.com/kenjis/ci-phpunit-test |
|
| 9 | - */ |
|
| 3 | + * Part of ci-phpunit-test |
|
| 4 | + * |
|
| 5 | + * @author Kenji Suzuki <https://github.com/kenjis> |
|
| 6 | + * @license MIT License |
|
| 7 | + * @copyright 2015 Kenji Suzuki |
|
| 8 | + * @link https://github.com/kenjis/ci-phpunit-test |
|
| 9 | + */ |
|
| 10 | 10 | |
| 11 | 11 | class CategorySeeder extends Seeder { |
| 12 | 12 | |
@@ -13,7 +13,6 @@ |
||
| 13 | 13 | use PhpParser\Node; |
| 14 | 14 | use PhpParser\Node\Stmt\ClassMethod; |
| 15 | 15 | use PhpParser\NodeVisitorAbstract; |
| 16 | - |
|
| 17 | 16 | use Kenjis\MonkeyPatch\Patcher\MethodPatcher; |
| 18 | 17 | |
| 19 | 18 | class NodeVisitor extends NodeVisitorAbstract |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | { |
| 21 | 21 | public function leaveNode(Node $node) |
| 22 | 22 | { |
| 23 | - if (! ($node instanceof ClassMethod)) |
|
| 23 | + if ( ! ($node instanceof ClassMethod)) |
|
| 24 | 24 | { |
| 25 | 25 | return; |
| 26 | 26 | } |
@@ -1,12 +1,12 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Part of ci-phpunit-test |
|
| 4 | - * |
|
| 5 | - * @author Kenji Suzuki <https://github.com/kenjis> |
|
| 6 | - * @license MIT License |
|
| 7 | - * @copyright 2015 Kenji Suzuki |
|
| 8 | - * @link https://github.com/kenjis/ci-phpunit-test |
|
| 9 | - */ |
|
| 3 | + * Part of ci-phpunit-test |
|
| 4 | + * |
|
| 5 | + * @author Kenji Suzuki <https://github.com/kenjis> |
|
| 6 | + * @license MIT License |
|
| 7 | + * @copyright 2015 Kenji Suzuki |
|
| 8 | + * @link https://github.com/kenjis/ci-phpunit-test |
|
| 9 | + */ |
|
| 10 | 10 | |
| 11 | 11 | class CategorySeeder extends Seeder { |
| 12 | 12 | |
@@ -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; |
@@ -158,14 +158,16 @@ discard block |
||
| 158 | 158 | if ($status_code < 100) |
| 159 | 159 | { |
| 160 | 160 | $exit_status = $status_code + 9; // 9 is EXIT__AUTO_MIN |
| 161 | - if ($exit_status > 125) // 125 is EXIT__AUTO_MAX |
|
| 161 | + if ($exit_status > 125) { |
|
| 162 | + // 125 is EXIT__AUTO_MAX |
|
| 162 | 163 | { |
| 163 | - $exit_status = 1; // EXIT_ERROR |
|
| 164 | + $exit_status = 1; |
|
| 165 | + } |
|
| 166 | + // EXIT_ERROR |
|
| 164 | 167 | } |
| 165 | 168 | |
| 166 | 169 | $status_code = 500; |
| 167 | - } |
|
| 168 | - else |
|
| 170 | + } else |
|
| 169 | 171 | { |
| 170 | 172 | $exit_status = 1; // EXIT_ERROR |
| 171 | 173 | } |
@@ -254,8 +256,7 @@ discard block |
||
| 254 | 256 | if (isset($stati[$code])) |
| 255 | 257 | { |
| 256 | 258 | $text = $stati[$code]; |
| 257 | - } |
|
| 258 | - else |
|
| 259 | + } else |
|
| 259 | 260 | { |
| 260 | 261 | show_error('No status text available. Please check your status code number or supply your own message text.', 500); |
| 261 | 262 | } |
@@ -281,8 +282,7 @@ discard block |
||
| 281 | 282 | if (strpos(PHP_SAPI, 'cgi') === 0) |
| 282 | 283 | { |
| 283 | 284 | header('Status: '.$code.' '.$text, TRUE); |
| 284 | - } |
|
| 285 | - else |
|
| 285 | + } else |
|
| 286 | 286 | { |
| 287 | 287 | $server_protocol = isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.1'; |
| 288 | 288 | header($server_protocol.' '.$code.' '.$text, TRUE, $code); |
@@ -325,8 +325,7 @@ discard block |
||
| 325 | 325 | if (file_exists($file_path = APPPATH.'config/'.ENVIRONMENT.'/config.php')) |
| 326 | 326 | { |
| 327 | 327 | require($file_path); |
| 328 | - } |
|
| 329 | - elseif ( ! $found) |
|
| 328 | + } elseif ( ! $found) |
|
| 330 | 329 | { |
| 331 | 330 | set_status_header(503); |
| 332 | 331 | echo 'The configuration file does not exist.'; |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | * @param string $library Library name |
| 186 | 186 | * @param array $params Optional parameters to pass to the library class constructor |
| 187 | 187 | * @param string $object_name An optional object name to assign to |
| 188 | - * @return object |
|
| 188 | + * @return CI_Loader |
|
| 189 | 189 | */ |
| 190 | 190 | public function library($library, $params = NULL, $object_name = NULL) |
| 191 | 191 | { |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | * @param string $model Model name |
| 230 | 230 | * @param string $name An optional object name to assign to |
| 231 | 231 | * @param bool $db_conn An optional database connection configuration to initialize |
| 232 | - * @return object |
|
| 232 | + * @return CI_Loader |
|
| 233 | 233 | * |
| 234 | 234 | * modified by ci-phpunit-test |
| 235 | 235 | */ |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | /** |
| 332 | 332 | * Database Loader |
| 333 | 333 | * |
| 334 | - * @param mixed $params Database configuration options |
|
| 334 | + * @param string|boolean $params Database configuration options |
|
| 335 | 335 | * @param bool $return Whether to return the database object |
| 336 | 336 | * @param bool $query_builder Whether to enable Query Builder |
| 337 | 337 | * (overrides the configuration setting) |
@@ -487,7 +487,7 @@ discard block |
||
| 487 | 487 | * An associative array or object containing values |
| 488 | 488 | * to be set, or a value's name if string |
| 489 | 489 | * @param string $val Value to set, only used if $vars is a string |
| 490 | - * @return object |
|
| 490 | + * @return CI_Loader |
|
| 491 | 491 | */ |
| 492 | 492 | public function vars($vars, $val = '') |
| 493 | 493 | { |
@@ -559,7 +559,7 @@ discard block |
||
| 559 | 559 | * Helper Loader |
| 560 | 560 | * |
| 561 | 561 | * @param string|string[] $helpers Helper name(s) |
| 562 | - * @return object |
|
| 562 | + * @return CI_Loader |
|
| 563 | 563 | */ |
| 564 | 564 | public function helper($helpers = array()) |
| 565 | 565 | { |
@@ -630,7 +630,7 @@ discard block |
||
| 630 | 630 | * |
| 631 | 631 | * @uses CI_Loader::helper() |
| 632 | 632 | * @param string|string[] $helpers Helper name(s) |
| 633 | - * @return object |
|
| 633 | + * @return CI_Loader |
|
| 634 | 634 | */ |
| 635 | 635 | public function helpers($helpers = array()) |
| 636 | 636 | { |
@@ -646,7 +646,7 @@ discard block |
||
| 646 | 646 | * |
| 647 | 647 | * @param string|string[] $files List of language file names to load |
| 648 | 648 | * @param string Language name |
| 649 | - * @return object |
|
| 649 | + * @return CI_Loader |
|
| 650 | 650 | */ |
| 651 | 651 | public function language($files, $lang = '') |
| 652 | 652 | { |
@@ -733,7 +733,7 @@ discard block |
||
| 733 | 733 | * |
| 734 | 734 | * @param string $path Path to add |
| 735 | 735 | * @param bool $view_cascade (default: TRUE) |
| 736 | - * @return object |
|
| 736 | + * @return CI_Loader |
|
| 737 | 737 | */ |
| 738 | 738 | public function add_package_path($path, $view_cascade = TRUE) |
| 739 | 739 | { |
@@ -777,7 +777,7 @@ discard block |
||
| 777 | 777 | * added path will be removed removed. |
| 778 | 778 | * |
| 779 | 779 | * @param string $path Path to remove |
| 780 | - * @return object |
|
| 780 | + * @return CI_Loader |
|
| 781 | 781 | */ |
| 782 | 782 | public function remove_package_path($path = '') |
| 783 | 783 | { |
@@ -1065,7 +1065,7 @@ discard block |
||
| 1065 | 1065 | * @used-by CI_Loader::_ci_load_library() |
| 1066 | 1066 | * @uses CI_Loader::_ci_init_library() |
| 1067 | 1067 | * |
| 1068 | - * @param string $library Library name to load |
|
| 1068 | + * @param string $library_name Library name to load |
|
| 1069 | 1069 | * @param string $file_path Path to the library filename, relative to libraries/ |
| 1070 | 1070 | * @param mixed $params Optional parameters to pass to the class constructor |
| 1071 | 1071 | * @param string $object_name Optional object name to assign to |
@@ -63,63 +63,63 @@ discard block |
||
| 63 | 63 | * |
| 64 | 64 | * @var array |
| 65 | 65 | */ |
| 66 | - protected $_ci_view_paths = array(VIEWPATH => TRUE); |
|
| 66 | + protected $_ci_view_paths = array(VIEWPATH => TRUE); |
|
| 67 | 67 | |
| 68 | 68 | /** |
| 69 | 69 | * List of paths to load libraries from |
| 70 | 70 | * |
| 71 | 71 | * @var array |
| 72 | 72 | */ |
| 73 | - protected $_ci_library_paths = array(APPPATH, BASEPATH); |
|
| 73 | + protected $_ci_library_paths = array(APPPATH, BASEPATH); |
|
| 74 | 74 | |
| 75 | 75 | /** |
| 76 | 76 | * List of paths to load models from |
| 77 | 77 | * |
| 78 | 78 | * @var array |
| 79 | 79 | */ |
| 80 | - protected $_ci_model_paths = array(APPPATH); |
|
| 80 | + protected $_ci_model_paths = array(APPPATH); |
|
| 81 | 81 | |
| 82 | 82 | /** |
| 83 | 83 | * List of paths to load helpers from |
| 84 | 84 | * |
| 85 | 85 | * @var array |
| 86 | 86 | */ |
| 87 | - protected $_ci_helper_paths = array(APPPATH, BASEPATH); |
|
| 87 | + protected $_ci_helper_paths = array(APPPATH, BASEPATH); |
|
| 88 | 88 | |
| 89 | 89 | /** |
| 90 | 90 | * List of cached variables |
| 91 | 91 | * |
| 92 | 92 | * @var array |
| 93 | 93 | */ |
| 94 | - protected $_ci_cached_vars = array(); |
|
| 94 | + protected $_ci_cached_vars = array(); |
|
| 95 | 95 | |
| 96 | 96 | /** |
| 97 | 97 | * List of loaded classes |
| 98 | 98 | * |
| 99 | 99 | * @var array |
| 100 | 100 | */ |
| 101 | - protected $_ci_classes = array(); |
|
| 101 | + protected $_ci_classes = array(); |
|
| 102 | 102 | |
| 103 | 103 | /** |
| 104 | 104 | * List of loaded models |
| 105 | 105 | * |
| 106 | 106 | * @var array |
| 107 | 107 | */ |
| 108 | - protected $_ci_models = array(); |
|
| 108 | + protected $_ci_models = array(); |
|
| 109 | 109 | |
| 110 | 110 | /** |
| 111 | 111 | * List of loaded helpers |
| 112 | 112 | * |
| 113 | 113 | * @var array |
| 114 | 114 | */ |
| 115 | - protected $_ci_helpers = array(); |
|
| 115 | + protected $_ci_helpers = array(); |
|
| 116 | 116 | |
| 117 | 117 | /** |
| 118 | 118 | * List of class name mappings |
| 119 | 119 | * |
| 120 | 120 | * @var array |
| 121 | 121 | */ |
| 122 | - protected $_ci_varmap = array( |
|
| 122 | + protected $_ci_varmap = array( |
|
| 123 | 123 | 'unit_test' => 'unit', |
| 124 | 124 | 'user_agent' => 'agent' |
| 125 | 125 | ); |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | public function __construct() |
| 137 | 137 | { |
| 138 | 138 | $this->_ci_ob_level = ob_get_level(); |
| 139 | - $this->_ci_classes =& is_loaded(); |
|
| 139 | + $this->_ci_classes = & is_loaded(); |
|
| 140 | 140 | |
| 141 | 141 | log_message('info', 'Loader Class Initialized'); |
| 142 | 142 | } |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | return $this; |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | - $CI =& get_instance(); |
|
| 274 | + $CI = & get_instance(); |
|
| 275 | 275 | if (isset($CI->$name)) |
| 276 | 276 | { |
| 277 | 277 | throw new RuntimeException('The model name you are loading is the name of a resource that is already being used: '.$name); |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | public function database($params = '', $return = FALSE, $query_builder = NULL) |
| 343 | 343 | { |
| 344 | 344 | // Grab the super object |
| 345 | - $CI =& get_instance(); |
|
| 345 | + $CI = & get_instance(); |
|
| 346 | 346 | |
| 347 | 347 | // Do we even need to load the database class? |
| 348 | 348 | if ($return === FALSE && $query_builder === NULL && isset($CI->db) && is_object($CI->db) && ! empty($CI->db->conn_id)) |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | $CI->db = ''; |
| 363 | 363 | |
| 364 | 364 | // Load the DB class |
| 365 | - $CI->db =& DB($params, $query_builder); |
|
| 365 | + $CI->db = & DB($params, $query_builder); |
|
| 366 | 366 | return $this; |
| 367 | 367 | } |
| 368 | 368 | |
@@ -377,12 +377,12 @@ discard block |
||
| 377 | 377 | */ |
| 378 | 378 | public function dbutil($db = NULL, $return = FALSE) |
| 379 | 379 | { |
| 380 | - $CI =& get_instance(); |
|
| 380 | + $CI = & get_instance(); |
|
| 381 | 381 | |
| 382 | 382 | if ( ! is_object($db) OR ! ($db instanceof CI_DB)) |
| 383 | 383 | { |
| 384 | 384 | class_exists('CI_DB', FALSE) OR $this->database(); |
| 385 | - $db =& $CI->db; |
|
| 385 | + $db = & $CI->db; |
|
| 386 | 386 | } |
| 387 | 387 | |
| 388 | 388 | require_once(BASEPATH.'database/DB_utility.php'); |
@@ -409,11 +409,11 @@ discard block |
||
| 409 | 409 | */ |
| 410 | 410 | public function dbforge($db = NULL, $return = FALSE) |
| 411 | 411 | { |
| 412 | - $CI =& get_instance(); |
|
| 412 | + $CI = & get_instance(); |
|
| 413 | 413 | if ( ! is_object($db) OR ! ($db instanceof CI_DB)) |
| 414 | 414 | { |
| 415 | 415 | class_exists('CI_DB', FALSE) OR $this->database(); |
| 416 | - $db =& $CI->db; |
|
| 416 | + $db = & $CI->db; |
|
| 417 | 417 | } |
| 418 | 418 | |
| 419 | 419 | require_once(BASEPATH.'database/DB_forge.php'); |
@@ -746,7 +746,7 @@ discard block |
||
| 746 | 746 | $this->_ci_view_paths = array($path.'views/' => $view_cascade) + $this->_ci_view_paths; |
| 747 | 747 | |
| 748 | 748 | // Add config file path |
| 749 | - $config =& $this->_ci_get_component('config'); |
|
| 749 | + $config = & $this->_ci_get_component('config'); |
|
| 750 | 750 | $config->_config_paths[] = $path; |
| 751 | 751 | |
| 752 | 752 | return $this; |
@@ -781,7 +781,7 @@ discard block |
||
| 781 | 781 | */ |
| 782 | 782 | public function remove_package_path($path = '') |
| 783 | 783 | { |
| 784 | - $config =& $this->_ci_get_component('config'); |
|
| 784 | + $config = & $this->_ci_get_component('config'); |
|
| 785 | 785 | |
| 786 | 786 | if ($path === '') |
| 787 | 787 | { |
@@ -882,12 +882,12 @@ discard block |
||
| 882 | 882 | |
| 883 | 883 | // This allows anything loaded using $this->load (views, files, etc.) |
| 884 | 884 | // to become accessible from within the Controller and Model functions. |
| 885 | - $_ci_CI =& get_instance(); |
|
| 885 | + $_ci_CI = & get_instance(); |
|
| 886 | 886 | foreach (get_object_vars($_ci_CI) as $_ci_key => $_ci_var) |
| 887 | 887 | { |
| 888 | 888 | if ( ! isset($this->$_ci_key)) |
| 889 | 889 | { |
| 890 | - $this->$_ci_key =& $_ci_CI->$_ci_key; |
|
| 890 | + $this->$_ci_key = & $_ci_CI->$_ci_key; |
|
| 891 | 891 | } |
| 892 | 892 | } |
| 893 | 893 | |
@@ -1026,7 +1026,7 @@ discard block |
||
| 1026 | 1026 | // return a new instance of the object |
| 1027 | 1027 | if ($object_name !== NULL) |
| 1028 | 1028 | { |
| 1029 | - $CI =& get_instance(); |
|
| 1029 | + $CI = & get_instance(); |
|
| 1030 | 1030 | if ( ! isset($CI->$object_name)) |
| 1031 | 1031 | { |
| 1032 | 1032 | return $this->_ci_init_library($class, '', $params, $object_name); |
@@ -1089,7 +1089,7 @@ discard block |
||
| 1089 | 1089 | // return a new instance of the object |
| 1090 | 1090 | if ($object_name !== NULL) |
| 1091 | 1091 | { |
| 1092 | - $CI =& get_instance(); |
|
| 1092 | + $CI = & get_instance(); |
|
| 1093 | 1093 | if ( ! isset($CI->$object_name)) |
| 1094 | 1094 | { |
| 1095 | 1095 | return $this->_ci_init_library($library_name, $prefix, $params, $object_name); |
@@ -1232,7 +1232,7 @@ discard block |
||
| 1232 | 1232 | } |
| 1233 | 1233 | |
| 1234 | 1234 | // Don't overwrite existing properties |
| 1235 | - $CI =& get_instance(); |
|
| 1235 | + $CI = & get_instance(); |
|
| 1236 | 1236 | if (isset($CI->$object_name)) |
| 1237 | 1237 | { |
| 1238 | 1238 | if ($CI->$object_name instanceof $class_name) |
@@ -1365,7 +1365,7 @@ discard block |
||
| 1365 | 1365 | */ |
| 1366 | 1366 | protected function &_ci_get_component($component) |
| 1367 | 1367 | { |
| 1368 | - $CI =& get_instance(); |
|
| 1368 | + $CI = & get_instance(); |
|
| 1369 | 1369 | return $CI->$component; |
| 1370 | 1370 | } |
| 1371 | 1371 | |
@@ -1,40 +1,40 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * CodeIgniter |
|
| 4 | - * |
|
| 5 | - * An open source application development framework for PHP |
|
| 6 | - * |
|
| 7 | - * This content is released under the MIT License (MIT) |
|
| 8 | - * |
|
| 9 | - * Copyright (c) 2014 - 2016, British Columbia Institute of Technology |
|
| 10 | - * |
|
| 11 | - * Permission is hereby granted, free of charge, to any person obtaining a copy |
|
| 12 | - * of this software and associated documentation files (the "Software"), to deal |
|
| 13 | - * in the Software without restriction, including without limitation the rights |
|
| 14 | - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
| 15 | - * copies of the Software, and to permit persons to whom the Software is |
|
| 16 | - * furnished to do so, subject to the following conditions: |
|
| 17 | - * |
|
| 18 | - * The above copyright notice and this permission notice shall be included in |
|
| 19 | - * all copies or substantial portions of the Software. |
|
| 20 | - * |
|
| 21 | - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
| 22 | - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
| 23 | - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
| 24 | - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
| 25 | - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
| 26 | - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
|
| 27 | - * THE SOFTWARE. |
|
| 28 | - * |
|
| 29 | - * @package CodeIgniter |
|
| 30 | - * @author EllisLab Dev Team |
|
| 31 | - * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) |
|
| 32 | - * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) |
|
| 33 | - * @license http://opensource.org/licenses/MIT MIT License |
|
| 34 | - * @link https://codeigniter.com |
|
| 35 | - * @since Version 1.0.0 |
|
| 36 | - * @filesource |
|
| 37 | - */ |
|
| 3 | + * CodeIgniter |
|
| 4 | + * |
|
| 5 | + * An open source application development framework for PHP |
|
| 6 | + * |
|
| 7 | + * This content is released under the MIT License (MIT) |
|
| 8 | + * |
|
| 9 | + * Copyright (c) 2014 - 2016, British Columbia Institute of Technology |
|
| 10 | + * |
|
| 11 | + * Permission is hereby granted, free of charge, to any person obtaining a copy |
|
| 12 | + * of this software and associated documentation files (the "Software"), to deal |
|
| 13 | + * in the Software without restriction, including without limitation the rights |
|
| 14 | + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
| 15 | + * copies of the Software, and to permit persons to whom the Software is |
|
| 16 | + * furnished to do so, subject to the following conditions: |
|
| 17 | + * |
|
| 18 | + * The above copyright notice and this permission notice shall be included in |
|
| 19 | + * all copies or substantial portions of the Software. |
|
| 20 | + * |
|
| 21 | + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
| 22 | + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
| 23 | + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
| 24 | + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
| 25 | + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
| 26 | + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
|
| 27 | + * THE SOFTWARE. |
|
| 28 | + * |
|
| 29 | + * @package CodeIgniter |
|
| 30 | + * @author EllisLab Dev Team |
|
| 31 | + * @copyright Copyright (c) 2008 - 2014, EllisLab, Inc. (https://ellislab.com/) |
|
| 32 | + * @copyright Copyright (c) 2014 - 2016, British Columbia Institute of Technology (http://bcit.ca/) |
|
| 33 | + * @license http://opensource.org/licenses/MIT MIT License |
|
| 34 | + * @link https://codeigniter.com |
|
| 35 | + * @since Version 1.0.0 |
|
| 36 | + * @filesource |
|
| 37 | + */ |
|
| 38 | 38 | defined('BASEPATH') OR exit('No direct script access allowed'); |
| 39 | 39 | |
| 40 | 40 | /** |
@@ -192,16 +192,14 @@ discard block |
||
| 192 | 192 | if (empty($library)) |
| 193 | 193 | { |
| 194 | 194 | return $this; |
| 195 | - } |
|
| 196 | - elseif (is_array($library)) |
|
| 195 | + } elseif (is_array($library)) |
|
| 197 | 196 | { |
| 198 | 197 | foreach ($library as $key => $value) |
| 199 | 198 | { |
| 200 | 199 | if (is_int($key)) |
| 201 | 200 | { |
| 202 | 201 | $this->library($value, $params); |
| 203 | - } |
|
| 204 | - else |
|
| 202 | + } else |
|
| 205 | 203 | { |
| 206 | 204 | $this->library($key, $params, $value); |
| 207 | 205 | } |
@@ -238,8 +236,7 @@ discard block |
||
| 238 | 236 | if (empty($model)) |
| 239 | 237 | { |
| 240 | 238 | return $this; |
| 241 | - } |
|
| 242 | - elseif (is_array($model)) |
|
| 239 | + } elseif (is_array($model)) |
|
| 243 | 240 | { |
| 244 | 241 | foreach ($model as $key => $value) |
| 245 | 242 | { |
@@ -305,8 +302,7 @@ discard block |
||
| 305 | 302 | { |
| 306 | 303 | throw new RuntimeException($app_path."Model.php exists, but doesn't declare class CI_Model"); |
| 307 | 304 | } |
| 308 | - } |
|
| 309 | - elseif ( ! class_exists('CI_Model', FALSE)) |
|
| 305 | + } elseif ( ! class_exists('CI_Model', FALSE)) |
|
| 310 | 306 | { |
| 311 | 307 | require_once(BASEPATH.'core'.DIRECTORY_SEPARATOR.'Model.php'); |
| 312 | 308 | } |
@@ -457,8 +453,7 @@ discard block |
||
| 457 | 453 | require_once($driver_path); |
| 458 | 454 | $class = 'CI_DB_'.$db->dbdriver.'_'.$db->subdriver.'_forge'; |
| 459 | 455 | } |
| 460 | - } |
|
| 461 | - else |
|
| 456 | + } else |
|
| 462 | 457 | { |
| 463 | 458 | $class = 'CI_DB_'.$db->dbdriver.'_forge'; |
| 464 | 459 | } |
@@ -725,16 +720,14 @@ discard block |
||
| 725 | 720 | if (is_int($key)) |
| 726 | 721 | { |
| 727 | 722 | $this->driver($value, $params); |
| 728 | - } |
|
| 729 | - else |
|
| 723 | + } else |
|
| 730 | 724 | { |
| 731 | 725 | $this->driver($key, $params, $value); |
| 732 | 726 | } |
| 733 | 727 | } |
| 734 | 728 | |
| 735 | 729 | return $this; |
| 736 | - } |
|
| 737 | - elseif (empty($library)) |
|
| 730 | + } elseif (empty($library)) |
|
| 738 | 731 | { |
| 739 | 732 | return FALSE; |
| 740 | 733 | } |
@@ -827,8 +820,7 @@ discard block |
||
| 827 | 820 | array_shift($this->_ci_helper_paths); |
| 828 | 821 | array_shift($this->_ci_view_paths); |
| 829 | 822 | array_pop($config->_config_paths); |
| 830 | - } |
|
| 831 | - else |
|
| 823 | + } else |
|
| 832 | 824 | { |
| 833 | 825 | $path = rtrim($path, '/').'/'; |
| 834 | 826 | foreach (array('_ci_library_paths', '_ci_model_paths', '_ci_helper_paths') as $var) |
@@ -890,8 +882,7 @@ discard block |
||
| 890 | 882 | { |
| 891 | 883 | $_ci_x = explode('/', $_ci_path); |
| 892 | 884 | $_ci_file = end($_ci_x); |
| 893 | - } |
|
| 894 | - else |
|
| 885 | + } else |
|
| 895 | 886 | { |
| 896 | 887 | $_ci_ext = pathinfo($_ci_view, PATHINFO_EXTENSION); |
| 897 | 888 | $_ci_file = ($_ci_ext === '') ? $_ci_view.'.php' : $_ci_view; |
@@ -969,8 +960,7 @@ discard block |
||
| 969 | 960 | if ( ! is_php('5.4') && ! ini_get('short_open_tag') && config_item('rewrite_short_tags') === TRUE) |
| 970 | 961 | { |
| 971 | 962 | echo eval('?>'.preg_replace('/;*\s*\?>/', '; ?>', str_replace('<?=', '<?php echo ', file_get_contents($_ci_path)))); |
| 972 | - } |
|
| 973 | - else |
|
| 963 | + } else |
|
| 974 | 964 | { |
| 975 | 965 | include($_ci_path); // include() vs include_once() allows for multiple views with the same name |
| 976 | 966 | } |
@@ -997,8 +987,7 @@ discard block |
||
| 997 | 987 | if (ob_get_level() > $this->_ci_ob_level + 1) |
| 998 | 988 | { |
| 999 | 989 | ob_end_flush(); |
| 1000 | - } |
|
| 1001 | - else |
|
| 990 | + } else |
|
| 1002 | 991 | { |
| 1003 | 992 | $_ci_CI->output->append_output(ob_get_contents()); |
| 1004 | 993 | @ob_end_clean(); |
@@ -1038,8 +1027,7 @@ discard block |
||
| 1038 | 1027 | |
| 1039 | 1028 | // Get the filename from the path |
| 1040 | 1029 | $class = substr($class, $last_slash); |
| 1041 | - } |
|
| 1042 | - else |
|
| 1030 | + } else |
|
| 1043 | 1031 | { |
| 1044 | 1032 | $subdir = ''; |
| 1045 | 1033 | } |
@@ -1180,8 +1168,7 @@ discard block |
||
| 1180 | 1168 | { |
| 1181 | 1169 | $prefix = config_item('subclass_prefix'); |
| 1182 | 1170 | break; |
| 1183 | - } |
|
| 1184 | - else |
|
| 1171 | + } else |
|
| 1185 | 1172 | { |
| 1186 | 1173 | log_message('debug', $path.' exists, but does not declare '.$subclass); |
| 1187 | 1174 | } |
@@ -1228,8 +1215,7 @@ discard block |
||
| 1228 | 1215 | { |
| 1229 | 1216 | include($path.'config/'.strtolower($class).'.php'); |
| 1230 | 1217 | $found = TRUE; |
| 1231 | - } |
|
| 1232 | - elseif (file_exists($path.'config/'.ucfirst(strtolower($class)).'.php')) |
|
| 1218 | + } elseif (file_exists($path.'config/'.ucfirst(strtolower($class)).'.php')) |
|
| 1233 | 1219 | { |
| 1234 | 1220 | include($path.'config/'.ucfirst(strtolower($class)).'.php'); |
| 1235 | 1221 | $found = TRUE; |
@@ -1239,8 +1225,7 @@ discard block |
||
| 1239 | 1225 | { |
| 1240 | 1226 | include($path.'config/'.ENVIRONMENT.'/'.strtolower($class).'.php'); |
| 1241 | 1227 | $found = TRUE; |
| 1242 | - } |
|
| 1243 | - elseif (file_exists($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php')) |
|
| 1228 | + } elseif (file_exists($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php')) |
|
| 1244 | 1229 | { |
| 1245 | 1230 | include($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php'); |
| 1246 | 1231 | $found = TRUE; |
@@ -1428,8 +1413,7 @@ discard block |
||
| 1428 | 1413 | if ( ! is_array($filename)) |
| 1429 | 1414 | { |
| 1430 | 1415 | return array(strtolower(str_replace(array($extension, '.php'), '', $filename).$extension)); |
| 1431 | - } |
|
| 1432 | - else |
|
| 1416 | + } else |
|
| 1433 | 1417 | { |
| 1434 | 1418 | foreach ($filename as $key => $val) |
| 1435 | 1419 | { |