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