| Conditions | 22 | 
| Paths | > 20000 | 
| Total Lines | 51 | 
| Code Lines | 36 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
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 | ||
| 165 | public function doFind() | ||
| 166 |     { | ||
| 167 | $lang = $this->lang; | ||
| 168 | $data = $this->misc->getDatabaseAccessor(); | ||
| 169 | |||
| 170 |         if (!isset($_REQUEST['term'])) { | ||
| 171 | $_REQUEST['term'] = ''; | ||
| 172 | } | ||
| 173 | |||
| 174 |         if (!isset($_REQUEST['filter'])) { | ||
| 175 | $_REQUEST['filter'] = ''; | ||
| 176 | } | ||
| 177 | |||
| 178 |         $default_html = $this->printTabs($this->misc->getNavTabs('popup'), 'find', false); | ||
| 179 | |||
| 180 | $default_html .= "<form action=\"database\" method=\"post\" target=\"detail\">\n"; | ||
| 181 |         $default_html .= $this->_printConnection('find'); | ||
| 182 |         $default_html .= '<p><input class="focusme" name="term" value="' . htmlspecialchars($_REQUEST['term']) . "\" size=\"32\" maxlength=\"{$data->_maxNameLen}\" />\n"; | ||
| 183 | |||
| 184 | // Output list of filters. This is complex due to all the 'has' and 'conf' feature possibilities | ||
| 185 | $default_html .= "<select name=\"filter\">\n"; | ||
| 186 |         $default_html .= "\t<option value=\"\"" . ('' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['strallobjects']}</option>\n"; | ||
| 187 |         $default_html .= "\t<option value=\"SCHEMA\"" . ('SCHEMA' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['strschemas']}</option>\n"; | ||
| 188 |         $default_html .= "\t<option value=\"TABLE\"" . ('TABLE' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['strtables']}</option>\n"; | ||
| 189 |         $default_html .= "\t<option value=\"VIEW\"" . ('VIEW' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['strviews']}</option>\n"; | ||
| 190 |         $default_html .= "\t<option value=\"SEQUENCE\"" . ('SEQUENCE' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['strsequences']}</option>\n"; | ||
| 191 |         $default_html .= "\t<option value=\"COLUMN\"" . ('COLUMN' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['strcolumns']}</option>\n"; | ||
| 192 |         $default_html .= "\t<option value=\"RULE\"" . ('RULE' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['strrules']}</option>\n"; | ||
| 193 |         $default_html .= "\t<option value=\"INDEX\"" . ('INDEX' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['strindexes']}</option>\n"; | ||
| 194 |         $default_html .= "\t<option value=\"TRIGGER\"" . ('TRIGGER' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['strtriggers']}</option>\n"; | ||
| 195 |         $default_html .= "\t<option value=\"CONSTRAINT\"" . ('CONSTRAINT' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['strconstraints']}</option>\n"; | ||
| 196 |         $default_html .= "\t<option value=\"FUNCTION\"" . ('FUNCTION' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['strfunctions']}</option>\n"; | ||
| 197 |         $default_html .= "\t<option value=\"DOMAIN\"" . ('DOMAIN' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['strdomains']}</option>\n"; | ||
| 198 |         if ($this->conf['show_advanced']) { | ||
| 199 |             $default_html .= "\t<option value=\"AGGREGATE\"" . ('AGGREGATE' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['straggregates']}</option>\n"; | ||
| 200 |             $default_html .= "\t<option value=\"TYPE\"" . ('TYPE' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['strtypes']}</option>\n"; | ||
| 201 |             $default_html .= "\t<option value=\"OPERATOR\"" . ('OPERATOR' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['stroperators']}</option>\n"; | ||
| 202 |             $default_html .= "\t<option value=\"OPCLASS\"" . ('OPCLASS' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['stropclasses']}</option>\n"; | ||
| 203 |             $default_html .= "\t<option value=\"CONVERSION\"" . ('CONVERSION' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['strconversions']}</option>\n"; | ||
| 204 |             $default_html .= "\t<option value=\"LANGUAGE\"" . ('LANGUAGE' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['strlanguages']}</option>\n"; | ||
| 205 | } | ||
| 206 | $default_html .= "</select>\n"; | ||
| 207 | |||
| 208 |         $default_html .= "<input type=\"submit\" value=\"{$lang['strfind']}\" />\n"; | ||
| 209 | $default_html .= "<input type=\"hidden\" name=\"action\" value=\"find\" /></p>\n"; | ||
| 210 | $default_html .= "</form>\n"; | ||
| 211 | |||
| 212 | // Default focus | ||
| 213 |         $this->setFocus('forms[0].term'); | ||
| 214 | |||
| 215 | return $default_html; | ||
| 216 | } | ||
| 218 |