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 |
||
141 | public function doFind() |
||
142 | { |
||
143 | $lang = $this->lang; |
||
144 | $data = $this->misc->getDatabaseAccessor(); |
||
145 | |||
146 | if (!isset($_REQUEST['term'])) { |
||
147 | $_REQUEST['term'] = ''; |
||
148 | } |
||
149 | |||
150 | if (!isset($_REQUEST['filter'])) { |
||
151 | $_REQUEST['filter'] = ''; |
||
152 | } |
||
153 | |||
154 | $default_html = $this->printTabs($this->misc->getNavTabs('popup'), 'find', false); |
||
155 | |||
156 | $default_html .= "<form action=\"database\" method=\"post\" target=\"detail\">\n"; |
||
157 | $default_html .= $this->printConnection('find', false); |
||
158 | $default_html .= '<p><input class="focusme" name="term" id="term" value="' . htmlspecialchars($_REQUEST['term']) . "\" size=\"32\" maxlength=\"{$data->_maxNameLen}\" />\n"; |
||
159 | |||
160 | // Output list of filters. This is complex due to all the 'has' and 'conf' feature possibilities |
||
161 | $default_html .= "<select id='filter' name=\"filter\">\n"; |
||
162 | $default_html .= "\t<option value=\"\"" . ('' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['strallobjects']}</option>\n"; |
||
163 | $default_html .= "\t<option value=\"SCHEMA\"" . ('SCHEMA' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['strschemas']}</option>\n"; |
||
164 | $default_html .= "\t<option value=\"TABLE\"" . ('TABLE' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['strtables']}</option>\n"; |
||
165 | $default_html .= "\t<option value=\"VIEW\"" . ('VIEW' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['strviews']}</option>\n"; |
||
166 | $default_html .= "\t<option value=\"SEQUENCE\"" . ('SEQUENCE' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['strsequences']}</option>\n"; |
||
167 | $default_html .= "\t<option value=\"COLUMN\"" . ('COLUMN' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['strcolumns']}</option>\n"; |
||
168 | $default_html .= "\t<option value=\"RULE\"" . ('RULE' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['strrules']}</option>\n"; |
||
169 | $default_html .= "\t<option value=\"INDEX\"" . ('INDEX' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['strindexes']}</option>\n"; |
||
170 | $default_html .= "\t<option value=\"TRIGGER\"" . ('TRIGGER' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['strtriggers']}</option>\n"; |
||
171 | $default_html .= "\t<option value=\"CONSTRAINT\"" . ('CONSTRAINT' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['strconstraints']}</option>\n"; |
||
172 | $default_html .= "\t<option value=\"FUNCTION\"" . ('FUNCTION' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['strfunctions']}</option>\n"; |
||
173 | $default_html .= "\t<option value=\"DOMAIN\"" . ('DOMAIN' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['strdomains']}</option>\n"; |
||
174 | if ($this->conf['show_advanced']) { |
||
175 | $default_html .= "\t<option value=\"AGGREGATE\"" . ('AGGREGATE' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['straggregates']}</option>\n"; |
||
176 | $default_html .= "\t<option value=\"TYPE\"" . ('TYPE' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['strtypes']}</option>\n"; |
||
177 | $default_html .= "\t<option value=\"OPERATOR\"" . ('OPERATOR' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['stroperators']}</option>\n"; |
||
178 | $default_html .= "\t<option value=\"OPCLASS\"" . ('OPCLASS' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['stropclasses']}</option>\n"; |
||
179 | $default_html .= "\t<option value=\"CONVERSION\"" . ('CONVERSION' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['strconversions']}</option>\n"; |
||
180 | $default_html .= "\t<option value=\"LANGUAGE\"" . ('LANGUAGE' == $_REQUEST['filter'] ? ' selected="selected" ' : '') . ">{$lang['strlanguages']}</option>\n"; |
||
181 | } |
||
182 | $default_html .= "</select>\n"; |
||
183 | |||
184 | $default_html .= "<input type=\"submit\" value=\"{$lang['strfind']}\" />\n"; |
||
185 | $default_html .= "<input type=\"hidden\" name=\"action\" value=\"find\" /></p>\n"; |
||
186 | $default_html .= "</form>\n"; |
||
187 | |||
188 | // Default focus |
||
189 | $this->setFocus('forms[0].term'); |
||
190 | |||
191 | return $default_html; |
||
192 | } |
||
194 |