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 |
||
187 | public function doFind() |
||
188 | { |
||
189 | $lang = $this->lang; |
||
190 | $data = $this->misc->getDatabaseAccessor(); |
||
191 | |||
192 | if (!isset($_REQUEST['term'])) { |
||
193 | $_REQUEST['term'] = ''; |
||
194 | } |
||
195 | |||
196 | if (!isset($_REQUEST['filter'])) { |
||
197 | $_REQUEST['filter'] = ''; |
||
198 | } |
||
199 | |||
200 | $default_html = $this->printTabs($this->misc->getNavTabs('popup'), 'find', false); |
||
201 | |||
202 | $default_html .= "<form action=\"database\" method=\"post\" target=\"detail\">\n"; |
||
203 | $default_html .= $this->_printConnection('find'); |
||
204 | $default_html .= '<p><input class="focusme" name="term" value="' . htmlspecialchars($_REQUEST['term']) . "\" size=\"32\" maxlength=\"{$data->_maxNameLen}\" />\n"; |
||
205 | |||
206 | // Output list of filters. This is complex due to all the 'has' and 'conf' feature possibilities |
||
207 | $default_html .= "<select name=\"filter\">\n"; |
||
208 | $default_html .= "\t<option value=\"\"" . ('' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['strallobjects']}</option>\n"; |
||
209 | $default_html .= "\t<option value=\"SCHEMA\"" . ('SCHEMA' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['strschemas']}</option>\n"; |
||
210 | $default_html .= "\t<option value=\"TABLE\"" . ('TABLE' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['strtables']}</option>\n"; |
||
211 | $default_html .= "\t<option value=\"VIEW\"" . ('VIEW' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['strviews']}</option>\n"; |
||
212 | $default_html .= "\t<option value=\"SEQUENCE\"" . ('SEQUENCE' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['strsequences']}</option>\n"; |
||
213 | $default_html .= "\t<option value=\"COLUMN\"" . ('COLUMN' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['strcolumns']}</option>\n"; |
||
214 | $default_html .= "\t<option value=\"RULE\"" . ('RULE' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['strrules']}</option>\n"; |
||
215 | $default_html .= "\t<option value=\"INDEX\"" . ('INDEX' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['strindexes']}</option>\n"; |
||
216 | $default_html .= "\t<option value=\"TRIGGER\"" . ('TRIGGER' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['strtriggers']}</option>\n"; |
||
217 | $default_html .= "\t<option value=\"CONSTRAINT\"" . ('CONSTRAINT' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['strconstraints']}</option>\n"; |
||
218 | $default_html .= "\t<option value=\"FUNCTION\"" . ('FUNCTION' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['strfunctions']}</option>\n"; |
||
219 | $default_html .= "\t<option value=\"DOMAIN\"" . ('DOMAIN' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['strdomains']}</option>\n"; |
||
220 | if ($this->conf['show_advanced']) { |
||
221 | $default_html .= "\t<option value=\"AGGREGATE\"" . ('AGGREGATE' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['straggregates']}</option>\n"; |
||
222 | $default_html .= "\t<option value=\"TYPE\"" . ('TYPE' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['strtypes']}</option>\n"; |
||
223 | $default_html .= "\t<option value=\"OPERATOR\"" . ('OPERATOR' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['stroperators']}</option>\n"; |
||
224 | $default_html .= "\t<option value=\"OPCLASS\"" . ('OPCLASS' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['stropclasses']}</option>\n"; |
||
225 | $default_html .= "\t<option value=\"CONVERSION\"" . ('CONVERSION' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['strconversions']}</option>\n"; |
||
226 | $default_html .= "\t<option value=\"LANGUAGE\"" . ('LANGUAGE' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['strlanguages']}</option>\n"; |
||
227 | } |
||
228 | $default_html .= "</select>\n"; |
||
229 | |||
230 | $default_html .= "<input type=\"submit\" value=\"{$lang['strfind']}\" />\n"; |
||
231 | $default_html .= "<input type=\"hidden\" name=\"action\" value=\"find\" /></p>\n"; |
||
232 | $default_html .= "</form>\n"; |
||
233 | |||
234 | // Default focus |
||
235 | $this->setFocus('forms[0].term'); |
||
236 | |||
237 | return $default_html; |
||
238 | } |
||
240 |