@@ -1122,6 +1122,10 @@ discard block |
||
1122 | 1122 | |
1123 | 1123 | var $list_level = 0; |
1124 | 1124 | |
1125 | + /** |
|
1126 | + * @param string $list_str |
|
1127 | + * @param string $marker_any_re |
|
1128 | + */ |
|
1125 | 1129 | function processListItems($list_str, $marker_any_re) |
1126 | 1130 | { |
1127 | 1131 | # |
@@ -1234,6 +1238,9 @@ discard block |
||
1234 | 1238 | return "\n\n" . $this->hashBlock($codeblock) . "\n\n"; |
1235 | 1239 | } |
1236 | 1240 | |
1241 | + /** |
|
1242 | + * @param string $code |
|
1243 | + */ |
|
1237 | 1244 | function makeCodeSpan($code) |
1238 | 1245 | { |
1239 | 1246 | # |
@@ -1751,6 +1758,9 @@ discard block |
||
1751 | 1758 | # hanlde UTF-8 if the default function does not exist. |
1752 | 1759 | var $utf8_strlen = 'mb_strlen'; |
1753 | 1760 | |
1761 | + /** |
|
1762 | + * @param string $text |
|
1763 | + */ |
|
1754 | 1764 | function detab($text) |
1755 | 1765 | { |
1756 | 1766 | # |
@@ -2340,6 +2350,11 @@ discard block |
||
2340 | 2350 | return array($parsed, $text); |
2341 | 2351 | } |
2342 | 2352 | |
2353 | + /** |
|
2354 | + * @param string $text |
|
2355 | + * @param string $hash_method |
|
2356 | + * @param boolean $md_attr |
|
2357 | + */ |
|
2343 | 2358 | function _hashHTMLBlocks_inHTML($text, $hash_method, $md_attr) |
2344 | 2359 | { |
2345 | 2360 | # |
@@ -3078,6 +3093,9 @@ discard block |
||
3078 | 3093 | return $this->hashBlock($result) . "\n\n"; |
3079 | 3094 | } |
3080 | 3095 | |
3096 | + /** |
|
3097 | + * @return string |
|
3098 | + */ |
|
3081 | 3099 | function processDefListItems($list_str) |
3082 | 3100 | { |
3083 | 3101 | # |
@@ -1636,8 +1636,10 @@ |
||
1636 | 1636 | $r = ($seed * (1 + $key)) % 100; # Pseudo-random function. |
1637 | 1637 | # roughly 10% raw, 45% hex, 45% dec |
1638 | 1638 | # '@' *must* be encoded. I insist. |
1639 | - if ($r > 90 && $char != '@') /* do nothing */ { |
|
1639 | + if ($r > 90 && $char != '@') { |
|
1640 | + /* do nothing */ { |
|
1640 | 1641 | ; |
1642 | + } |
|
1641 | 1643 | } else if ($r < 45) { |
1642 | 1644 | $chars[$key] = '&#x' . dechex($ord) . ';'; |
1643 | 1645 | } else { |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | * |
322 | 322 | * @param string $type Any key from _migration_paths, or {module_name} |
323 | 323 | * |
324 | - * @return bool|string |
|
324 | + * @return false|string |
|
325 | 325 | */ |
326 | 326 | public function get_latest($type='app') |
327 | 327 | { |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | /** |
466 | 466 | * Based on the 'type', determines the correct migration path. |
467 | 467 | * |
468 | - * @param $type |
|
468 | + * @param string $type |
|
469 | 469 | * @param bool $create |
470 | 470 | * |
471 | 471 | * @return null|string |
@@ -208,8 +208,7 @@ discard block |
||
208 | 208 | if ($this->_migration_type === 'sequential') |
209 | 209 | { |
210 | 210 | $target_version = sprintf('%03d', $target_version); |
211 | - } |
|
212 | - else |
|
211 | + } else |
|
213 | 212 | { |
214 | 213 | $target_version = (string) $target_version; |
215 | 214 | } |
@@ -226,8 +225,7 @@ discard block |
||
226 | 225 | { |
227 | 226 | // Moving Up |
228 | 227 | $method = 'up'; |
229 | - } |
|
230 | - else |
|
228 | + } else |
|
231 | 229 | { |
232 | 230 | // Moving Down, apply in reverse order |
233 | 231 | $method = 'down'; |
@@ -437,8 +435,7 @@ discard block |
||
437 | 435 | if ($this->_migration_type == 'timestamp') |
438 | 436 | { |
439 | 437 | $prefix = date('YmdHis'); |
440 | - } |
|
441 | - else |
|
438 | + } else |
|
442 | 439 | { |
443 | 440 | $prefix = str_pad($this->get_version() + 1, 3, '0', STR_PAD_LEFT); |
444 | 441 | } |
@@ -292,7 +292,7 @@ |
||
292 | 292 | * @param $user_id |
293 | 293 | * @param $key |
294 | 294 | * |
295 | - * @return bool |
|
295 | + * @return false|null |
|
296 | 296 | */ |
297 | 297 | public function removeMetaFromUser($user_id, $key) |
298 | 298 | { |
@@ -203,8 +203,7 @@ discard block |
||
203 | 203 | if ($query->num_rows() == 0) |
204 | 204 | { |
205 | 205 | $this->db->insert('user_meta', $obj); |
206 | - } |
|
207 | - else if ($query->num_rows() > 0) |
|
206 | + } else if ($query->num_rows() > 0) |
|
208 | 207 | { |
209 | 208 | $this->db->where('user_id', $data['id']) |
210 | 209 | ->where('meta_key', $key) |
@@ -304,8 +303,7 @@ discard block |
||
304 | 303 | if (is_array($key)) |
305 | 304 | { |
306 | 305 | $this->db->where_in('meta_key', $key); |
307 | - } |
|
308 | - else |
|
306 | + } else |
|
309 | 307 | { |
310 | 308 | $this->db->where('meta_key', $key); |
311 | 309 | } |
@@ -351,8 +349,7 @@ discard block |
||
351 | 349 | if (is_object($data['fields'])) |
352 | 350 | { |
353 | 351 | $data['fields']->meta = (object)$meta; |
354 | - } |
|
355 | - else |
|
352 | + } else |
|
356 | 353 | { |
357 | 354 | $data['fields']['meta']= $meta; |
358 | 355 | } |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * @param string the name of the class |
108 | 108 | * @param mixed the optional parameters |
109 | 109 | * @param string an optional object name |
110 | - * @return void |
|
110 | + * @return null|HMVC_Loader |
|
111 | 111 | */ |
112 | 112 | public function library($library = '', $params = NULL, $object_name = NULL) { |
113 | 113 | if (is_array($library)) { |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * @param string the name of the class |
148 | 148 | * @param string name for the model |
149 | 149 | * @param bool database connection |
150 | - * @return void |
|
150 | + * @return null|HMVC_Loader |
|
151 | 151 | */ |
152 | 152 | public function model($model, $name = '', $db_conn = FALSE) { |
153 | 153 | if (is_array($model)) { |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | * @param string |
233 | 233 | * @param bool |
234 | 234 | * @param bool |
235 | - * @return void |
|
235 | + * @return boolean|null |
|
236 | 236 | */ |
237 | 237 | public function config($file = '', $use_sections = FALSE, $fail_gracefully = FALSE) { |
238 | 238 | // Detect module |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | * This function loads the specified helper file. |
264 | 264 | * |
265 | 265 | * @param mixed |
266 | - * @return void |
|
266 | + * @return null|HMVC_Loader |
|
267 | 267 | */ |
268 | 268 | public function helper($helper = array()) { |
269 | 269 | if (is_array($helper)) { |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | * |
301 | 301 | * @param array |
302 | 302 | * @param string |
303 | - * @return void |
|
303 | + * @return null|HMVC_Loader |
|
304 | 304 | */ |
305 | 305 | public function language($file = array(), $lang = '') { |
306 | 306 | if (is_array($file)) { |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | * Searches a given module name. Returns the path if found, FALSE otherwise |
518 | 518 | * |
519 | 519 | * @param string $module |
520 | - * @return string|boolean |
|
520 | + * @return string|false |
|
521 | 521 | */ |
522 | 522 | private function find_module($module) { |
523 | 523 | $config = & $this->_ci_get_component('config'); |
@@ -29,8 +29,9 @@ |
||
29 | 29 | * |
30 | 30 | */ |
31 | 31 | |
32 | -if (!defined("BASEPATH")) |
|
32 | +if (!defined("BASEPATH")) { |
|
33 | 33 | exit("No direct script access allowed"); |
34 | +} |
|
34 | 35 | |
35 | 36 | class HMVC_Loader extends CI_Loader { |
36 | 37 |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | * Copies the entire contents of a single folder |
22 | 22 | * into a source folder, recursively. |
23 | 23 | * |
24 | - * @param $source |
|
25 | - * @param $destination |
|
24 | + * @param string $source |
|
25 | + * @param string $destination |
|
26 | 26 | */ |
27 | 27 | public function copyFolder($source, $destination) |
28 | 28 | { |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | * Deletes all files and folders, recursively, within $path, |
72 | 72 | * except for any files listed in the $leave_files array. |
73 | 73 | * |
74 | - * @param $path |
|
75 | - * @param array $leave_files |
|
74 | + * @param string $path |
|
75 | + * @param string[] $leave_files |
|
76 | 76 | */ |
77 | 77 | public function cleanFolder($path, $leave_files=[]) |
78 | 78 | { |
@@ -97,6 +97,10 @@ discard block |
||
97 | 97 | |
98 | 98 | //-------------------------------------------------------------------- |
99 | 99 | |
100 | + /** |
|
101 | + * @param string $source |
|
102 | + * @param string $destination |
|
103 | + */ |
|
100 | 104 | public function compressFolder($source, $destination, $include_dir=false) |
101 | 105 | { |
102 | 106 | if (! extension_loaded('zip') ) { |
@@ -37,8 +37,7 @@ discard block |
||
37 | 37 | if ( is_dir($source .'/'. $file) ) |
38 | 38 | { |
39 | 39 | $this->copyFolder($source .'/'. $file, $destination .'/'. $file); |
40 | - } |
|
41 | - else { |
|
40 | + } else { |
|
42 | 41 | copy($source .'/'. $file, $destination .'/'. $file); |
43 | 42 | } |
44 | 43 | } |
@@ -87,8 +86,7 @@ discard block |
||
87 | 86 | { |
88 | 87 | $this->cleanFolder($file, $leave_files); |
89 | 88 | rmdir($file); |
90 | - } |
|
91 | - else |
|
89 | + } else |
|
92 | 90 | { |
93 | 91 | unlink($file); |
94 | 92 | } |
@@ -147,22 +145,21 @@ discard block |
||
147 | 145 | $file = str_replace('\\', '/', $file); |
148 | 146 | |
149 | 147 | // Ignore "." and ".." folders |
150 | - if( in_array(substr($file, strrpos($file, '/')+1), array('.', '..', '.DS_Store')) ) |
|
151 | - continue; |
|
148 | + if( in_array(substr($file, strrpos($file, '/')+1), array('.', '..', '.DS_Store')) ) { |
|
149 | + continue; |
|
150 | + } |
|
152 | 151 | |
153 | 152 | $file = realpath($file); |
154 | 153 | |
155 | 154 | if (is_dir($file) === true) |
156 | 155 | { |
157 | 156 | $zip->addEmptyDir(str_replace($source . '/', '', $file . '/')); |
158 | - } |
|
159 | - else if (is_file($file) === true) |
|
157 | + } else if (is_file($file) === true) |
|
160 | 158 | { |
161 | 159 | $zip->addFromString(str_replace($source . '/', '', $file), file_get_contents($file)); |
162 | 160 | } |
163 | 161 | } |
164 | - } |
|
165 | - else if (is_file($source) === true) |
|
162 | + } else if (is_file($source) === true) |
|
166 | 163 | { |
167 | 164 | $zip->addFromString(basename($source), file_get_contents($source)); |
168 | 165 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * Quickly creates boilerplate code for a new API resource. |
104 | 104 | * |
105 | 105 | * @param $segments |
106 | - * @param $quiet |
|
106 | + * @param boolean $quiet |
|
107 | 107 | */ |
108 | 108 | private function scaffold( $segments, $quiet ) |
109 | 109 | { |
@@ -220,6 +220,9 @@ discard block |
||
220 | 220 | |
221 | 221 | //-------------------------------------------------------------------- |
222 | 222 | |
223 | + /** |
|
224 | + * @param string $name |
|
225 | + */ |
|
223 | 226 | private function detectModel($name) |
224 | 227 | { |
225 | 228 | $model_name = ucfirst($name) .'_model.php'; |
@@ -242,8 +245,8 @@ discard block |
||
242 | 245 | /** |
243 | 246 | * Creates the new APIController - based resource with basic CRUD. |
244 | 247 | * |
245 | - * @param $single |
|
246 | - * @param $plural |
|
248 | + * @param string $single |
|
249 | + * @param string $plural |
|
247 | 250 | * @param $version |
248 | 251 | * |
249 | 252 | * @return $this |
@@ -271,8 +274,8 @@ discard block |
||
271 | 274 | /** |
272 | 275 | * Creates the language file to accompany the controller. |
273 | 276 | * |
274 | - * @param $single |
|
275 | - * @param $plural |
|
277 | + * @param string $single |
|
278 | + * @param string $plural |
|
276 | 279 | * @param $version |
277 | 280 | * |
278 | 281 | * @return $this |
@@ -297,8 +300,8 @@ discard block |
||
297 | 300 | * Creates the API Blueprint file for that resource in |
298 | 301 | * APPPATH/docs/api |
299 | 302 | * |
300 | - * @param $single |
|
301 | - * @param $plural |
|
303 | + * @param string $single |
|
304 | + * @param string $plural |
|
302 | 305 | * @param $version |
303 | 306 | * @param $model |
304 | 307 | * |
@@ -349,7 +352,7 @@ discard block |
||
349 | 352 | * Modifies the _toc.ini file (or creates) for the specified Blueprint docs. |
350 | 353 | * |
351 | 354 | * @param $plural |
352 | - * @param $version |
|
355 | + * @param string $version |
|
353 | 356 | * |
354 | 357 | * @return $this|bool |
355 | 358 | */ |
@@ -385,7 +388,7 @@ discard block |
||
385 | 388 | * Creates a generic representation of the object from the database |
386 | 389 | * table. |
387 | 390 | * |
388 | - * @param $model |
|
391 | + * @param string $model |
|
389 | 392 | * |
390 | 393 | * @return string |
391 | 394 | */ |
@@ -537,6 +540,10 @@ discard block |
||
537 | 540 | //-------------------------------------------------------------------- |
538 | 541 | |
539 | 542 | |
543 | + /** |
|
544 | + * @param string $tpl |
|
545 | + * @param string $name |
|
546 | + */ |
|
540 | 547 | private function makeMigration( $tpl, $name ) |
541 | 548 | { |
542 | 549 | // Create the migration |
@@ -561,7 +568,7 @@ discard block |
||
561 | 568 | /** |
562 | 569 | * Modifies the config/api.php file and sets the Auth type |
563 | 570 | * |
564 | - * @param $type |
|
571 | + * @param string $type |
|
565 | 572 | */ |
566 | 573 | private function setAuthType( $type ) |
567 | 574 | { |
@@ -228,8 +228,7 @@ discard block |
||
228 | 228 | { |
229 | 229 | CLI::write("\nUnable to find model named: {$model_name}"); |
230 | 230 | $model_name = CLI::prompt('Model filename'); |
231 | - } |
|
232 | - else |
|
231 | + } else |
|
233 | 232 | { |
234 | 233 | CLI::write("Using model: ". CLI::color($model_name, 'yellow') ); |
235 | 234 | } |
@@ -423,12 +422,10 @@ discard block |
||
423 | 422 | if ($field->name == 'email') |
424 | 423 | { |
425 | 424 | $obj .= "\"[email protected]\",\n"; |
426 | - } |
|
427 | - else if (strpos('name', $field->name) !== false) |
|
425 | + } else if (strpos('name', $field->name) !== false) |
|
428 | 426 | { |
429 | 427 | $obj .= "\"Lefty\",\n"; |
430 | - } |
|
431 | - else if (in_array($field->type, ['char', 'varchar', 'text'])) |
|
428 | + } else if (in_array($field->type, ['char', 'varchar', 'text'])) |
|
432 | 429 | { |
433 | 430 | $obj .= "\"Some default string\",\n"; |
434 | 431 | } |
@@ -97,6 +97,9 @@ discard block |
||
97 | 97 | |
98 | 98 | //-------------------------------------------------------------------- |
99 | 99 | |
100 | + /** |
|
101 | + * @param string $name |
|
102 | + */ |
|
100 | 103 | protected function quietSetOptions( $name ) |
101 | 104 | { |
102 | 105 | $options = CLI::getOptions(); |
@@ -120,6 +123,9 @@ discard block |
||
120 | 123 | |
121 | 124 | //-------------------------------------------------------------------- |
122 | 125 | |
126 | + /** |
|
127 | + * @param string $name |
|
128 | + */ |
|
123 | 129 | protected function collectOptions( $name ) |
124 | 130 | { |
125 | 131 | $options = CLI::getOptions(); |
@@ -159,6 +165,7 @@ discard block |
||
159 | 165 | |
160 | 166 | /** |
161 | 167 | * Generates the standard views for our CRUD methods. |
168 | + * @param string $name |
|
162 | 169 | */ |
163 | 170 | protected function createViews( $name ) |
164 | 171 | { |
@@ -62,8 +62,7 @@ discard block |
||
62 | 62 | if ( $quiet === FALSE ) |
63 | 63 | { |
64 | 64 | $this->collectOptions( $name ); |
65 | - } |
|
66 | - else |
|
65 | + } else |
|
67 | 66 | { |
68 | 67 | $this->quietSetOptions( $name ); |
69 | 68 | } |
@@ -212,8 +211,7 @@ discard block |
||
212 | 211 | { |
213 | 212 | return NULL; |
214 | 213 | } |
215 | - } |
|
216 | - else |
|
214 | + } else |
|
217 | 215 | { |
218 | 216 | return NULL; |
219 | 217 | } |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | * 'create_user_table' action = 'create', table = 'user' |
160 | 160 | * 'add_name_to_user_table action = 'add', table = 'user' |
161 | 161 | * |
162 | - * @param $name |
|
162 | + * @param string $name |
|
163 | 163 | */ |
164 | 164 | public function detectAction($name) |
165 | 165 | { |
@@ -199,6 +199,9 @@ discard block |
||
199 | 199 | |
200 | 200 | //-------------------------------------------------------------------- |
201 | 201 | |
202 | + /** |
|
203 | + * @param string $name |
|
204 | + */ |
|
202 | 205 | public function collectOptions($name, $quiet=false) |
203 | 206 | { |
204 | 207 | $options = CLI::getOptions(); |
@@ -308,7 +311,7 @@ discard block |
||
308 | 311 | * Reads the fields from an existing table and fills out our |
309 | 312 | * $fields array and $primary key information. |
310 | 313 | * |
311 | - * @param $table |
|
314 | + * @param string $table |
|
312 | 315 | */ |
313 | 316 | protected function readTable($table) |
314 | 317 | { |
@@ -278,8 +278,7 @@ discard block |
||
278 | 278 | if (! empty($size)) |
279 | 279 | { |
280 | 280 | $f['constraint'] = (int)$size; |
281 | - } |
|
282 | - else if (array_key_exists($type, $this->defaultSizes)) |
|
281 | + } else if (array_key_exists($type, $this->defaultSizes)) |
|
283 | 282 | { |
284 | 283 | $f['constraint'] = $this->defaultSizes[$type]; |
285 | 284 | } |
@@ -342,14 +341,15 @@ discard block |
||
342 | 341 | if (! empty($field->max_length)) |
343 | 342 | { |
344 | 343 | $f['constraint'] = $field->max_length; |
345 | - } |
|
346 | - else if (array_key_exists($field->type, $this->defaultSizes)) |
|
344 | + } else if (array_key_exists($field->type, $this->defaultSizes)) |
|
347 | 345 | { |
348 | 346 | $f['constraint'] = $this->defaultSizes[ $field->type ]; |
349 | 347 | } |
350 | 348 | |
351 | 349 | // Default |
352 | - if (! empty($field->default)) $f['default'] = $field->default; |
|
350 | + if (! empty($field->default)) { |
|
351 | + $f['default'] = $field->default; |
|
352 | + } |
|
353 | 353 | |
354 | 354 | // Primary Key? |
355 | 355 | if (! empty($field->primary_key) && $field->primary_key == 1) |
@@ -107,6 +107,10 @@ discard block |
||
107 | 107 | /* |
108 | 108 | * Customizes our settings |
109 | 109 | */ |
110 | + |
|
111 | + /** |
|
112 | + * @param string $model_name |
|
113 | + */ |
|
110 | 114 | protected function collectOptions( $model_name, $options=[] ) |
111 | 115 | { |
112 | 116 | $this->load->helper( 'inflector' ); |
@@ -180,6 +184,9 @@ discard block |
||
180 | 184 | |
181 | 185 | //-------------------------------------------------------------------- |
182 | 186 | |
187 | + /** |
|
188 | + * @param string $model_name |
|
189 | + */ |
|
183 | 190 | protected function quietSetOptions( $model_name, $options=[] ) |
184 | 191 | { |
185 | 192 | $this->load->helper( 'inflector' ); |
@@ -79,8 +79,7 @@ discard block |
||
79 | 79 | if ( $quiet === false ) |
80 | 80 | { |
81 | 81 | $this->collectOptions( $name, $options ); |
82 | - } |
|
83 | - else |
|
82 | + } else |
|
84 | 83 | { |
85 | 84 | $this->quietSetOptions( $name, $options ); |
86 | 85 | } |
@@ -219,8 +218,7 @@ discard block |
||
219 | 218 | } |
220 | 219 | |
221 | 220 | $fields = $this->parseFieldString($options['fields']); |
222 | - } |
|
223 | - else |
|
221 | + } else |
|
224 | 222 | { |
225 | 223 | $fields = $this->db->field_data( $table_name ); |
226 | 224 | } |