| Conditions | 7 |
| Paths | 18 |
| Total Lines | 59 |
| Code Lines | 28 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 56 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php |
||
| 26 | function display() { |
||
| 27 | |||
| 28 | if (!isset($_REQUEST['quick_address'])) $_REQUEST['quick_address'] = ''; |
||
| 29 | ?> |
||
| 30 | |||
| 31 | <div class="moduleTitle"><h2><?php echo $GLOBALS['mod_strings']['LBL_MAP_QUICK_RADIUS']; ?><div class="clear"></div></h2></div> |
||
| 32 | <div class="clear"></div> |
||
| 33 | |||
| 34 | <form name="quickradius" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="get"> |
||
| 35 | <input type="hidden" name="module" value="<?php echo $GLOBALS['currentModule']; ?>"> |
||
| 36 | <input type="hidden" name="action" value="quick_radius_display" /> |
||
| 37 | |||
| 38 | <table border="0"> |
||
| 39 | <tr> |
||
| 40 | <td> |
||
| 41 | <strong><?php echo $GLOBALS['mod_strings']['LBL_MAP_ADDRESS'].': '; ?> </strong> |
||
| 42 | </td> |
||
| 43 | <td> |
||
| 44 | <input type="text" name="quick_address" id="quick_address" |
||
| 45 | value="<?php echo htmlspecialchars($_REQUEST['quick_address']); ?>" title='' tabindex='101' size="40" maxlength="255"> |
||
| 46 | </td> |
||
| 47 | </tr> |
||
| 48 | <tr> |
||
| 49 | <td> |
||
| 50 | <strong><?php echo $GLOBALS['mod_strings']['LBL_MODULE_TYPE'].' '; ?> </strong> |
||
| 51 | </td> |
||
| 52 | <td> |
||
| 53 | <select id="display_module" tabindex="111" title="<?php echo $GLOBALS['mod_strings']['LBL_MODULE_TYPE']; ?>" name="display_module"> |
||
| 54 | <?php foreach ($GLOBALS['jjwg_config']['valid_geocode_modules'] as $module) { ?> |
||
| 55 | <option value="<?php echo htmlspecialchars($module); ?>" <?php |
||
| 56 | if (!empty($_REQUEST['display_module']) && $module == $_REQUEST['display_module']) echo 'selected="selected"'; |
||
| 57 | ?>><?php echo htmlspecialchars($GLOBALS['app_list_strings']['moduleList'][$module]); ?> |
||
| 58 | <?php } ?> |
||
| 59 | </select> |
||
| 60 | </td> |
||
| 61 | </tr> |
||
| 62 | <tr> |
||
| 63 | <td> |
||
| 64 | <strong><?php echo $GLOBALS['mod_strings']['LBL_DISTANCE'].' '; ?> </strong> |
||
| 65 | </td> |
||
| 66 | <td> |
||
| 67 | <input type="text" name="distance" id="distance" |
||
| 68 | value="<?php echo htmlspecialchars($_REQUEST['distance']); ?>" title='' tabindex='121' size="10" maxlength="10"> |
||
| 69 | <select id="unit_type" tabindex="131" title="<?php echo $GLOBALS['mod_strings']['LBL_DISTANCE']; ?>" name="unit_type"> |
||
| 70 | <?php foreach ($GLOBALS['app_list_strings']['map_unit_type_list'] as $key=>$value) { ?> |
||
| 71 | <option value="<?php echo htmlspecialchars($key); ?>" <?php |
||
| 72 | if ($key == $_REQUEST['unit_type']) echo 'selected="selected"'; |
||
| 73 | ?>><?php echo htmlspecialchars($value); ?> |
||
| 74 | <?php } ?> |
||
| 75 | </select> |
||
| 76 | </td> |
||
| 77 | </tr> |
||
| 78 | </table> |
||
| 79 | <br /> |
||
| 80 | <input class="button" tabindex="211" type="submit" name="submit" value="<?php echo $GLOBALS['mod_strings']['LBL_MAP_PROCESS']; ?>" align="bottom"> |
||
| 81 | </form> |
||
| 82 | |||
| 83 | <?php |
||
| 84 | } |
||
| 85 | } |
||
| 86 |