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