@@ -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); |
@@ -259,7 +259,7 @@ |
||
259 | 259 | |
260 | 260 | // Save status code in Output object |
261 | 261 | // added by ci-phpunit-test |
262 | - $CI =& get_instance(); |
|
262 | + $CI = & get_instance(); |
|
263 | 263 | $output = $CI->output; |
264 | 264 | $output->_status = [ |
265 | 265 | 'code' => $code, |
@@ -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 |
@@ -26,10 +26,10 @@ discard block |
||
26 | 26 | */ |
27 | 27 | private static function fixPath() |
28 | 28 | { |
29 | - $file = static::TEST_FOLDER . '/Bootstrap.php'; |
|
29 | + $file = static::TEST_FOLDER.'/Bootstrap.php'; |
|
30 | 30 | $contents = file_get_contents($file); |
31 | 31 | |
32 | - if (! file_exists('system')) { |
|
32 | + if ( ! file_exists('system')) { |
|
33 | 33 | if (file_exists('vendor/codeigniter/framework/system')) { |
34 | 34 | $contents = str_replace( |
35 | 35 | '$system_path = \'../../system\';', |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | } |
42 | 42 | } |
43 | 43 | |
44 | - if (! file_exists('index.php')) { |
|
44 | + if ( ! file_exists('index.php')) { |
|
45 | 45 | if (file_exists('public/index.php')) { |
46 | 46 | $contents = str_replace( |
47 | 47 | "define('FCPATH', realpath(dirname(__FILE__).'/../..').'/');", |
@@ -82,11 +82,11 @@ discard block |
||
82 | 82 | |
83 | 83 | foreach ($iterator as $file) { |
84 | 84 | if ($file->isDir()) { |
85 | - @mkdir($dst . '/' . $iterator->getSubPathName()); |
|
85 | + @mkdir($dst.'/'.$iterator->getSubPathName()); |
|
86 | 86 | } else { |
87 | - $success = copy($file, $dst . '/' . $iterator->getSubPathName()); |
|
87 | + $success = copy($file, $dst.'/'.$iterator->getSubPathName()); |
|
88 | 88 | if ($success) { |
89 | - echo 'copied: ' . $dst . '/' . $iterator->getSubPathName() . PHP_EOL; |
|
89 | + echo 'copied: '.$dst.'/'.$iterator->getSubPathName().PHP_EOL; |
|
90 | 90 | } |
91 | 91 | } |
92 | 92 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | |
17 | 17 | public function __construct() |
18 | 18 | { |
19 | - $this->CI =& get_instance(); |
|
19 | + $this->CI = & get_instance(); |
|
20 | 20 | $this->CI->load->database(); |
21 | 21 | $this->CI->load->dbforge(); |
22 | 22 | $this->db = $this->CI->db; |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | */ |
31 | 31 | public function call($seeder) |
32 | 32 | { |
33 | - $file = APPPATH . 'database/seeds/' . $seeder . '.php'; |
|
33 | + $file = APPPATH.'database/seeds/'.$seeder.'.php'; |
|
34 | 34 | require_once $file; |
35 | 35 | $obj = new $seeder; |
36 | 36 | $obj->run(); |