| Conditions | 17 |
| Paths | 256 |
| Total Lines | 47 |
| Code Lines | 36 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 1 | 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 declare(strict_types=1); |
||
| 72 | function b_suico_lastpictures_edit($options) |
||
| 73 | { |
||
| 74 | $form = _MB_SUICO_SHOWPICTURETITLE . ' '; |
||
| 75 | $chk = ''; |
||
| 76 | if (isset($options[0]) && 0 != $options[0]) { |
||
| 77 | $chk = ' checked'; |
||
| 78 | } |
||
| 79 | $form .= "<input type='radio' name='options[0]' value='1'" . $chk . ' > ' . _YES . ''; |
||
| 80 | $chk = ''; |
||
| 81 | if (!isset($options[0]) || 0 == $options[0]) { |
||
| 82 | $chk = ' checked'; |
||
| 83 | } |
||
| 84 | $form .= " <input type='radio' name='options[0]' value='0'" . $chk . ' >' . _NO . '<br>'; |
||
| 85 | $form .= _MB_SUICO_SHOWPICTURECAPTION . ' '; |
||
| 86 | if (isset($options[1]) && 1 == $options[1]) { |
||
| 87 | $chk = ' checked'; |
||
| 88 | } |
||
| 89 | $form .= "<input type='radio' name='options[1]' value='1'" . $chk . ' > ' . _YES . ''; |
||
| 90 | $chk = ''; |
||
| 91 | if (!isset($options[1]) || 0 == $options[1]) { |
||
| 92 | $chk = ' checked'; |
||
| 93 | } |
||
| 94 | $form .= " <input type='radio' name='options[1]' value='0'" . $chk . ' >' . _NO . '<br>'; |
||
| 95 | $form .= _MB_SUICO_SHOWPICTUREDATE . ' '; |
||
| 96 | if (isset($options[2]) && 1 == $options[2]) { |
||
| 97 | $chk = ' checked'; |
||
| 98 | } |
||
| 99 | $form .= "<input type='radio' name='options[2]' value='1'" . $chk . ' > ' . _YES . ''; |
||
| 100 | $chk = ''; |
||
| 101 | if (!isset($options[2]) || 0 == $options[2]) { |
||
| 102 | $chk = ' checked'; |
||
| 103 | } |
||
| 104 | $form .= " <input type='radio' name='options[2]' value='0'" . $chk . ' >' . _NO . '<br>'; |
||
| 105 | $form .= _MB_SUICO_SHOWPICTUREOWNER . ' '; |
||
| 106 | if (isset($options[3]) && 1 == $options[3]) { |
||
| 107 | $chk = ' checked'; |
||
| 108 | } |
||
| 109 | $form .= "<input type='radio' name='options[3]' value='1'" . $chk . ' > ' . _YES . ''; |
||
| 110 | $chk = ''; |
||
| 111 | if (!isset($options[3]) || 0 == $options[3]) { |
||
| 112 | $chk = ' checked'; |
||
| 113 | } |
||
| 114 | $form .= " <input type='radio' name='options[3]' value='0'" . $chk . ' >' . _NO . '<br>'; |
||
| 115 | $form .= _MB_SUICO_TOTALPICTUREDISPLAY . ' '; |
||
| 116 | $form .= "<input type='text' name='options[4]' value='" . ($options[4] ?? 0) . "'>"; |
||
| 117 | |||
| 118 | return $form; |
||
| 119 | } |
||
| 120 |