| Conditions | 7 |
| Paths | 3 |
| Total Lines | 71 |
| Code Lines | 55 |
| 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 |
||
| 183 | public function doProperties($msg = '') |
||
| 184 | { |
||
| 185 | $conf = $this->conf; |
||
| 186 | |||
| 187 | $lang = $this->lang; |
||
| 188 | $data = $this->misc->getDatabaseAccessor(); |
||
| 189 | |||
| 190 | $this->printTrail('operator'); |
||
| 191 | $this->printTitle($lang['strproperties'], 'pg.operator'); |
||
| 192 | $this->printMsg($msg); |
||
| 193 | |||
| 194 | $oprdata = $data->getOperator($_REQUEST['operator_oid']); |
||
| 195 | $oprdata->fields['oprcanhash'] = $data->phpBool($oprdata->fields['oprcanhash']); |
||
| 196 | |||
| 197 | if ($oprdata->recordCount() > 0) { |
||
| 198 | echo "<table>\n"; |
||
| 199 | echo "<tr><th class=\"data left\">{$lang['strname']}</th>\n"; |
||
| 200 | echo '<td class="data1">', $this->misc->printVal($oprdata->fields['oprname']), "</td></tr>\n"; |
||
| 201 | echo "<tr><th class=\"data left\">{$lang['strleftarg']}</th>\n"; |
||
| 202 | echo '<td class="data1">', $this->misc->printVal($oprdata->fields['oprleftname']), "</td></tr>\n"; |
||
| 203 | echo "<tr><th class=\"data left\">{$lang['strrightarg']}</th>\n"; |
||
| 204 | echo '<td class="data1">', $this->misc->printVal($oprdata->fields['oprrightname']), "</td></tr>\n"; |
||
| 205 | echo "<tr><th class=\"data left\">{$lang['strcommutator']}</th>\n"; |
||
| 206 | echo '<td class="data1">', $this->misc->printVal($oprdata->fields['oprcom']), "</td></tr>\n"; |
||
| 207 | echo "<tr><th class=\"data left\">{$lang['strnegator']}</th>\n"; |
||
| 208 | echo '<td class="data1">', $this->misc->printVal($oprdata->fields['oprnegate']), "</td></tr>\n"; |
||
| 209 | echo "<tr><th class=\"data left\">{$lang['strjoin']}</th>\n"; |
||
| 210 | echo '<td class="data1">', $this->misc->printVal($oprdata->fields['oprjoin']), "</td></tr>\n"; |
||
| 211 | echo "<tr><th class=\"data left\">{$lang['strhashes']}</th>\n"; |
||
| 212 | echo '<td class="data1">', ($oprdata->fields['oprcanhash']) ? $lang['stryes'] : $lang['strno'], "</td></tr>\n"; |
||
| 213 | |||
| 214 | // these field only exists in 8.2 and before in pg_catalog |
||
| 215 | if (isset($oprdata->fields['oprlsortop'])) { |
||
| 216 | echo "<tr><th class=\"data left\">{$lang['strmerges']}</th>\n"; |
||
| 217 | echo '<td class="data1">', ('0' !== $oprdata->fields['oprlsortop'] && '0' !== $oprdata->fields['oprrsortop']) ? $lang['stryes'] : $lang['strno'], "</td></tr>\n"; |
||
| 218 | echo "<tr><th class=\"data left\">{$lang['strrestrict']}</th>\n"; |
||
| 219 | echo '<td class="data1">', $this->misc->printVal($oprdata->fields['oprrest']), "</td></tr>\n"; |
||
| 220 | echo "<tr><th class=\"data left\">{$lang['strleftsort']}</th>\n"; |
||
| 221 | echo '<td class="data1">', $this->misc->printVal($oprdata->fields['oprlsortop']), "</td></tr>\n"; |
||
| 222 | echo "<tr><th class=\"data left\">{$lang['strrightsort']}</th>\n"; |
||
| 223 | echo '<td class="data1">', $this->misc->printVal($oprdata->fields['oprrsortop']), "</td></tr>\n"; |
||
| 224 | echo "<tr><th class=\"data left\">{$lang['strlessthan']}</th>\n"; |
||
| 225 | echo '<td class="data1">', $this->misc->printVal($oprdata->fields['oprltcmpop']), "</td></tr>\n"; |
||
| 226 | echo "<tr><th class=\"data left\">{$lang['strgreaterthan']}</th>\n"; |
||
| 227 | echo '<td class="data1">', $this->misc->printVal($oprdata->fields['oprgtcmpop']), "</td></tr>\n"; |
||
| 228 | } else { |
||
| 229 | echo "<tr><th class=\"data left\">{$lang['strmerges']}</th>\n"; |
||
| 230 | echo '<td class="data1">', $data->phpBool($oprdata->fields['oprcanmerge']) ? $lang['stryes'] : $lang['strno'], "</td></tr>\n"; |
||
| 231 | } |
||
| 232 | echo "</table>\n"; |
||
| 233 | |||
| 234 | $this->printNavLinks( |
||
| 235 | [ |
||
| 236 | 'showall' => [ |
||
| 237 | 'attr' => [ |
||
| 238 | 'href' => [ |
||
| 239 | 'url' => 'operators.php', |
||
| 240 | 'urlvars' => [ |
||
| 241 | 'server' => $_REQUEST['server'], |
||
| 242 | 'database' => $_REQUEST['database'], |
||
| 243 | 'schema' => $_REQUEST['schema'], |
||
| 244 | ], |
||
| 245 | ], |
||
| 246 | ], |
||
| 247 | 'content' => $lang['strshowalloperators'], |
||
| 248 | ], ], |
||
| 249 | 'operators-properties', |
||
| 250 | get_defined_vars() |
||
| 251 | ); |
||
| 252 | } else { |
||
| 253 | $this->doDefault($lang['strinvalidparam']); |
||
| 254 | } |
||
| 294 |