@@ -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 | } |
@@ -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)) |
@@ -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 | } |
@@ -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; |
@@ -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 | } |
@@ -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); |
@@ -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); |
@@ -154,14 +154,16 @@ discard block |
||
154 | 154 | if ($status_code < 100) |
155 | 155 | { |
156 | 156 | $exit_status = $status_code + 9; // 9 is EXIT__AUTO_MIN |
157 | - if ($exit_status > 125) // 125 is EXIT__AUTO_MAX |
|
157 | + if ($exit_status > 125) { |
|
158 | + // 125 is EXIT__AUTO_MAX |
|
158 | 159 | { |
159 | - $exit_status = 1; // EXIT_ERROR |
|
160 | + $exit_status = 1; |
|
161 | + } |
|
162 | + // EXIT_ERROR |
|
160 | 163 | } |
161 | 164 | |
162 | 165 | $status_code = 500; |
163 | - } |
|
164 | - else |
|
166 | + } else |
|
165 | 167 | { |
166 | 168 | $exit_status = 1; // EXIT_ERROR |
167 | 169 | } |
@@ -250,8 +252,7 @@ discard block |
||
250 | 252 | if (isset($stati[$code])) |
251 | 253 | { |
252 | 254 | $text = $stati[$code]; |
253 | - } |
|
254 | - else |
|
255 | + } else |
|
255 | 256 | { |
256 | 257 | show_error('No status text available. Please check your status code number or supply your own message text.', 500); |
257 | 258 | } |
@@ -277,8 +278,7 @@ discard block |
||
277 | 278 | if (strpos(PHP_SAPI, 'cgi') === 0) |
278 | 279 | { |
279 | 280 | header('Status: '.$code.' '.$text, TRUE); |
280 | - } |
|
281 | - else |
|
281 | + } else |
|
282 | 282 | { |
283 | 283 | $server_protocol = isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.1'; |
284 | 284 | header($server_protocol.' '.$code.' '.$text, TRUE, $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 |
@@ -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 | { |
@@ -427,8 +424,7 @@ discard block |
||
427 | 424 | require_once($driver_path); |
428 | 425 | $class = 'CI_DB_'.$db->dbdriver.'_'.$db->subdriver.'_forge'; |
429 | 426 | } |
430 | - } |
|
431 | - else |
|
427 | + } else |
|
432 | 428 | { |
433 | 429 | $class = 'CI_DB_'.$db->dbdriver.'_forge'; |
434 | 430 | } |
@@ -696,8 +692,7 @@ discard block |
||
696 | 692 | } |
697 | 693 | |
698 | 694 | return $this; |
699 | - } |
|
700 | - elseif (empty($library)) |
|
695 | + } elseif (empty($library)) |
|
701 | 696 | { |
702 | 697 | return FALSE; |
703 | 698 | } |
@@ -790,8 +785,7 @@ discard block |
||
790 | 785 | array_shift($this->_ci_helper_paths); |
791 | 786 | array_shift($this->_ci_view_paths); |
792 | 787 | array_pop($config->_config_paths); |
793 | - } |
|
794 | - else |
|
788 | + } else |
|
795 | 789 | { |
796 | 790 | $path = rtrim($path, '/').'/'; |
797 | 791 | foreach (array('_ci_library_paths', '_ci_model_paths', '_ci_helper_paths') as $var) |
@@ -853,8 +847,7 @@ discard block |
||
853 | 847 | { |
854 | 848 | $_ci_x = explode('/', $_ci_path); |
855 | 849 | $_ci_file = end($_ci_x); |
856 | - } |
|
857 | - else |
|
850 | + } else |
|
858 | 851 | { |
859 | 852 | $_ci_ext = pathinfo($_ci_view, PATHINFO_EXTENSION); |
860 | 853 | $_ci_file = ($_ci_ext === '') ? $_ci_view.'.php' : $_ci_view; |
@@ -924,8 +917,7 @@ discard block |
||
924 | 917 | if ( ! is_php('5.4') && ! ini_get('short_open_tag') && config_item('rewrite_short_tags') === TRUE) |
925 | 918 | { |
926 | 919 | echo eval('?>'.preg_replace('/;*\s*\?>/', '; ?>', str_replace('<?=', '<?php echo ', file_get_contents($_ci_path)))); |
927 | - } |
|
928 | - else |
|
920 | + } else |
|
929 | 921 | { |
930 | 922 | include($_ci_path); // include() vs include_once() allows for multiple views with the same name |
931 | 923 | } |
@@ -952,8 +944,7 @@ discard block |
||
952 | 944 | if (ob_get_level() > $this->_ci_ob_level + 1) |
953 | 945 | { |
954 | 946 | ob_end_flush(); |
955 | - } |
|
956 | - else |
|
947 | + } else |
|
957 | 948 | { |
958 | 949 | $_ci_CI->output->append_output(ob_get_contents()); |
959 | 950 | @ob_end_clean(); |
@@ -993,8 +984,7 @@ discard block |
||
993 | 984 | |
994 | 985 | // Get the filename from the path |
995 | 986 | $class = substr($class, $last_slash); |
996 | - } |
|
997 | - else |
|
987 | + } else |
|
998 | 988 | { |
999 | 989 | $subdir = ''; |
1000 | 990 | } |
@@ -1135,8 +1125,7 @@ discard block |
||
1135 | 1125 | { |
1136 | 1126 | $prefix = config_item('subclass_prefix'); |
1137 | 1127 | break; |
1138 | - } |
|
1139 | - else |
|
1128 | + } else |
|
1140 | 1129 | { |
1141 | 1130 | log_message('debug', $path.' exists, but does not declare '.$subclass); |
1142 | 1131 | } |
@@ -1183,8 +1172,7 @@ discard block |
||
1183 | 1172 | { |
1184 | 1173 | include($path.'config/'.strtolower($class).'.php'); |
1185 | 1174 | $found = TRUE; |
1186 | - } |
|
1187 | - elseif (file_exists($path.'config/'.ucfirst(strtolower($class)).'.php')) |
|
1175 | + } elseif (file_exists($path.'config/'.ucfirst(strtolower($class)).'.php')) |
|
1188 | 1176 | { |
1189 | 1177 | include($path.'config/'.ucfirst(strtolower($class)).'.php'); |
1190 | 1178 | $found = TRUE; |
@@ -1194,8 +1182,7 @@ discard block |
||
1194 | 1182 | { |
1195 | 1183 | include($path.'config/'.ENVIRONMENT.'/'.strtolower($class).'.php'); |
1196 | 1184 | $found = TRUE; |
1197 | - } |
|
1198 | - elseif (file_exists($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php')) |
|
1185 | + } elseif (file_exists($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php')) |
|
1199 | 1186 | { |
1200 | 1187 | include($path.'config/'.ENVIRONMENT.'/'.ucfirst(strtolower($class)).'.php'); |
1201 | 1188 | $found = TRUE; |
@@ -1386,8 +1373,7 @@ discard block |
||
1386 | 1373 | if ( ! is_array($filename)) |
1387 | 1374 | { |
1388 | 1375 | return array(strtolower(str_replace(array($extension, '.php'), '', $filename).$extension)); |
1389 | - } |
|
1390 | - else |
|
1376 | + } else |
|
1391 | 1377 | { |
1392 | 1378 | foreach ($filename as $key => $val) |
1393 | 1379 | { |
@@ -80,8 +80,7 @@ discard block |
||
80 | 80 | if (version_compare(PHP_VERSION, '5.3', '>=')) |
81 | 81 | { |
82 | 82 | error_reporting(E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT & ~E_USER_NOTICE & ~E_USER_DEPRECATED); |
83 | - } |
|
84 | - else |
|
83 | + } else |
|
85 | 84 | { |
86 | 85 | error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_USER_NOTICE); |
87 | 86 | } |
@@ -203,8 +202,7 @@ discard block |
||
203 | 202 | if (($_temp = realpath($system_path)) !== FALSE) |
204 | 203 | { |
205 | 204 | $system_path = $_temp.'/'; |
206 | - } |
|
207 | - else |
|
205 | + } else |
|
208 | 206 | { |
209 | 207 | // Ensure there's a trailing slash |
210 | 208 | $system_path = rtrim($system_path, '/').'/'; |
@@ -244,8 +242,7 @@ discard block |
||
244 | 242 | } |
245 | 243 | |
246 | 244 | define('APPPATH', $application_folder.DIRECTORY_SEPARATOR); |
247 | - } |
|
248 | - else |
|
245 | + } else |
|
249 | 246 | { |
250 | 247 | if ( ! is_dir(BASEPATH.$application_folder.DIRECTORY_SEPARATOR)) |
251 | 248 | { |
@@ -263,14 +260,12 @@ discard block |
||
263 | 260 | if ( ! empty($view_folder) && is_dir(APPPATH.$view_folder.DIRECTORY_SEPARATOR)) |
264 | 261 | { |
265 | 262 | $view_folder = APPPATH.$view_folder; |
266 | - } |
|
267 | - elseif ( ! is_dir(APPPATH.'views'.DIRECTORY_SEPARATOR)) |
|
263 | + } elseif ( ! is_dir(APPPATH.'views'.DIRECTORY_SEPARATOR)) |
|
268 | 264 | { |
269 | 265 | header('HTTP/1.1 503 Service Unavailable.', TRUE, 503); |
270 | 266 | echo 'Your view folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF; |
271 | 267 | exit(3); // EXIT_CONFIG |
272 | - } |
|
273 | - else |
|
268 | + } else |
|
274 | 269 | { |
275 | 270 | $view_folder = APPPATH.'views'; |
276 | 271 | } |
@@ -279,8 +274,7 @@ discard block |
||
279 | 274 | if (($_temp = realpath($view_folder)) !== FALSE) |
280 | 275 | { |
281 | 276 | $view_folder = $_temp.DIRECTORY_SEPARATOR; |
282 | - } |
|
283 | - else |
|
277 | + } else |
|
284 | 278 | { |
285 | 279 | $view_folder = rtrim($view_folder, '/\\').DIRECTORY_SEPARATOR; |
286 | 280 | } |
@@ -43,8 +43,7 @@ discard block |
||
43 | 43 | APPPATH.'controllers', |
44 | 44 | APPPATH.'modules', |
45 | 45 | ]; |
46 | - } |
|
47 | - else |
|
46 | + } else |
|
48 | 47 | { |
49 | 48 | $this->dirs = $dirs; |
50 | 49 | } |
@@ -85,8 +84,7 @@ discard block |
||
85 | 84 | { |
86 | 85 | $dir = __DIR__; |
87 | 86 | $this->loadClassFile($dir, $class); |
88 | - } |
|
89 | - else |
|
87 | + } else |
|
90 | 88 | { |
91 | 89 | $dir = __DIR__ . '/exceptions'; |
92 | 90 | $this->loadClassFile($dir, $class); |
@@ -151,8 +149,7 @@ discard block |
||
151 | 149 | { |
152 | 150 | require $filename; |
153 | 151 | return true; |
154 | - } |
|
155 | - else |
|
152 | + } else |
|
156 | 153 | { |
157 | 154 | unset($this->cache[$class]); |
158 | 155 | } |