@@ -19,8 +19,8 @@ |
||
| 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); |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | // Set $_GET if URI string has query string |
| 32 | 32 | parse_str($query_string, $_GET); |
| 33 | 33 | // Remove query string from URI string |
| 34 | - $argv = substr($argv, 0, -strlen($query_string)-1); |
|
| 34 | + $argv = substr($argv, 0, -strlen($query_string) - 1); |
|
| 35 | 35 | } |
| 36 | 36 | } |
| 37 | 37 | |
@@ -64,12 +64,12 @@ discard block |
||
| 64 | 64 | if ($_GET !== []) |
| 65 | 65 | { |
| 66 | 66 | $_SERVER['REQUEST_URI'] = |
| 67 | - '/' . $path . '?' |
|
| 67 | + '/'.$path.'?' |
|
| 68 | 68 | . http_build_query($_GET); |
| 69 | 69 | } |
| 70 | 70 | else |
| 71 | 71 | { |
| 72 | - $_SERVER['REQUEST_URI'] = '/' . $path; |
|
| 72 | + $_SERVER['REQUEST_URI'] = '/'.$path; |
|
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | if ($query_string === false) |
| 88 | 88 | { |
| 89 | - throw new LogicException('Bad URI string: ' . $uri); |
|
| 89 | + throw new LogicException('Bad URI string: '.$uri); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | return $query_string; |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | } |
| 112 | 112 | else |
| 113 | 113 | { |
| 114 | - $key = 'HTTP_' . $normalized_name; |
|
| 114 | + $key = 'HTTP_'.$normalized_name; |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | $_SERVER[$key] = $value; |
@@ -9,10 +9,10 @@ discard block |
||
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | 11 | // Autoloader for ci-phpunit-test |
| 12 | -require __DIR__ . '/CIPHPUnitTestAutoloader.php'; |
|
| 13 | -require __DIR__ . '/CIPHPUnitTestFileCache.php'; |
|
| 12 | +require __DIR__.'/CIPHPUnitTestAutoloader.php'; |
|
| 13 | +require __DIR__.'/CIPHPUnitTestFileCache.php'; |
|
| 14 | 14 | $cache = new CIPHPUnitTestFileCache( |
| 15 | - __DIR__ . '/tmp/cache/autoload.php' |
|
| 15 | + __DIR__.'/tmp/cache/autoload.php' |
|
| 16 | 16 | ); |
| 17 | 17 | $autoload_dirs = CIPHPUnitTest::getAutoloadDirs(); |
| 18 | 18 | $autoloader = new CIPHPUnitTestAutoloader($cache, $autoload_dirs); |
@@ -20,5 +20,5 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | // Register CodeIgniter's tests/mocks/autoloader.php |
| 22 | 22 | define('SYSTEM_PATH', BASEPATH); |
| 23 | -require APPPATH .'tests/mocks/autoloader.php'; |
|
| 23 | +require APPPATH.'tests/mocks/autoloader.php'; |
|
| 24 | 24 | spl_autoload_register('autoload'); |
@@ -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 | } |
@@ -59,7 +59,7 @@ |
||
| 59 | 59 | { |
| 60 | 60 | $this->unwrap(); |
| 61 | 61 | |
| 62 | - MonkeyPatchManager::log('stream_open: ' . $path); |
|
| 62 | + MonkeyPatchManager::log('stream_open: '.$path); |
|
| 63 | 63 | |
| 64 | 64 | $including = (bool) ($options & self::STREAM_OPEN_FOR_INCLUDE); |
| 65 | 65 | if ($including && $this->shouldPreprocess($path)) { |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | PHPUnit_Framework_TestCase::assertEquals( |
| 55 | 55 | $expected_times, |
| 56 | 56 | $actual_times, |
| 57 | - $class_method . '() expected to be not invoked, but invoked ' . $actual_times . ' times.' |
|
| 57 | + $class_method.'() expected to be not invoked, but invoked '.$actual_times.' times.' |
|
| 58 | 58 | ); |
| 59 | 59 | } |
| 60 | 60 | elseif ($expected_times === '+') |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | PHPUnit_Framework_TestCase::assertGreaterThanOrEqual( |
| 63 | 63 | 1, |
| 64 | 64 | $actual_times, |
| 65 | - $class_method . '() expected to be invoked at least one time, but invoked ' . $actual_times . ' times.' |
|
| 65 | + $class_method.'() expected to be invoked at least one time, but invoked '.$actual_times.' times.' |
|
| 66 | 66 | ); |
| 67 | 67 | } |
| 68 | 68 | else |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | PHPUnit_Framework_TestCase::assertEquals( |
| 71 | 71 | $expected_times, |
| 72 | 72 | $actual_times, |
| 73 | - $class_method . '() expected to be invoked ' . $expected_times . ' times, but invoked ' . $actual_times . ' times.' |
|
| 73 | + $class_method.'() expected to be invoked '.$expected_times.' times, but invoked '.$actual_times.' times.' |
|
| 74 | 74 | ); |
| 75 | 75 | } |
| 76 | 76 | } |
@@ -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; |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | public static function getInfo($patcher, $backtrace) |
| 23 | 23 | { |
| 24 | - if (! isset(self::$map[$patcher])) |
|
| 24 | + if ( ! isset(self::$map[$patcher])) |
|
| 25 | 25 | { |
| 26 | 26 | throw new LogicException("No such a patcher: $patcher"); |
| 27 | 27 | } |
@@ -41,12 +41,12 @@ discard block |
||
| 41 | 41 | $line = isset($backtrace[$offset]['line']) |
| 42 | 42 | ? $backtrace[$offset]['line'] : null; |
| 43 | 43 | |
| 44 | - if (isset($backtrace[$offset+2])) |
|
| 44 | + if (isset($backtrace[$offset + 2])) |
|
| 45 | 45 | { |
| 46 | - $class = isset($backtrace[$offset+2]['class']) |
|
| 47 | - ? $backtrace[$offset+2]['class'] |
|
| 46 | + $class = isset($backtrace[$offset + 2]['class']) |
|
| 47 | + ? $backtrace[$offset + 2]['class'] |
|
| 48 | 48 | : null; |
| 49 | - $function = $backtrace[$offset+2]['function']; |
|
| 49 | + $function = $backtrace[$offset + 2]['function']; |
|
| 50 | 50 | } |
| 51 | 51 | else |
| 52 | 52 | { |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | if (isset($class)) |
| 58 | 58 | { |
| 59 | 59 | $method = $function; |
| 60 | - $class_method = $class . '::' . $function; |
|
| 60 | + $class_method = $class.'::'.$function; |
|
| 61 | 61 | $function = null; |
| 62 | 62 | } |
| 63 | 63 | else |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | namespace Kenjis\MonkeyPatch\Patcher; |
| 12 | 12 | |
| 13 | -require __DIR__ . '/../Exception/ExitException.php'; |
|
| 13 | +require __DIR__.'/../Exception/ExitException.php'; |
|
| 14 | 14 | |
| 15 | 15 | class ExitPatcher |
| 16 | 16 | { |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | } |
| 31 | 31 | elseif ($token[0] === T_EXIT) |
| 32 | 32 | { |
| 33 | - if ($tokens[$i+1] === ';') |
|
| 33 | + if ($tokens[$i + 1] === ';') |
|
| 34 | 34 | { |
| 35 | 35 | $new_source .= 'exit__()'; |
| 36 | 36 | } |