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