Conditions | 11 |
Paths | 192 |
Total Lines | 62 |
Code Lines | 44 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
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 |
||
166 | public function render($currentoption = 1, $display = true) |
||
167 | { |
||
168 | global $modversion; |
||
169 | $_dirname = $this->_obj->getVar('dirname'); |
||
170 | $i = 0; |
||
171 | |||
172 | /** |
||
173 | * Select current menu tab, sets id names for menu tabs |
||
174 | */ |
||
175 | $j=0; |
||
176 | foreach ($this->_menutabs as $k => $menus) { |
||
177 | if ($j == $currentoption) { |
||
178 | $breadcrumb = $menus; |
||
179 | } |
||
180 | $menuItems[] = 'modmenu_' . $j++; |
||
181 | } |
||
182 | |||
183 | $menuItems[$currentoption] = 'current'; |
||
184 | $menu = "<div id='buttontop_mod'>"; |
||
185 | $menu .= "<table style='width: 100%; padding: 0;' cellspacing='0'>\n<tr>"; |
||
186 | $menu .= "<td style='font-size: 10px; text-align: left; color: #2F5376; padding: 0 6px; line-height: 18px;'>"; |
||
187 | foreach ($this->_menutop as $k => $v) { |
||
188 | $menu .= " <a href=\"$k\">$v</a> |"; |
||
189 | } |
||
190 | $menu = substr($menu, 0, -1); |
||
191 | |||
192 | $menu .= '</td>'; |
||
193 | $menu .= "<td style='text-align: right;'><strong>" . $this->_obj->getVar('name') . '</strong> : ' . $breadcrumb . '</td>'; |
||
194 | $menu .= "</tr>\n</table>\n"; |
||
195 | $menu .= "</div>\n"; |
||
196 | $menu .= "<div id='buttonbar_mod'><ul>"; |
||
197 | foreach ($this->_menutabs as $k => $v) { |
||
198 | $menu .= "<li id='" . $menuItems[$i] . "'><a href='" . XOOPS_URL . '/modules/' . $this->_obj->getVar('dirname') . '/' . $k . "'><span>$v</span></a></li>\n"; |
||
199 | ++$i; |
||
200 | } |
||
201 | $menu .= "</ul>\n</div>\n"; |
||
202 | if ($this->_header) { |
||
203 | $menu .= "<h4 class='admin_header'>"; |
||
204 | if (isset($modversion['name'])) { |
||
205 | if ($modversion['image'] && $this->_obj->getVar('mid') == 1) { |
||
206 | $system_image = XOOPS_URL . '/modules/system/images/system/' . $modversion['image']; |
||
207 | } else { |
||
208 | $system_image = XOOPS_URL . '/modules/' . $_dirname . '/images/' . $modversion['image']; |
||
209 | } |
||
210 | $menu .= "<img src='$system_image' align='middle' height='32' width='32' alt='' />"; |
||
211 | $menu .= ' ' . $modversion['name'] . "</h4>\n"; |
||
212 | } else { |
||
213 | $menu .= ' ' . $this->_header . "</h4>\n"; |
||
214 | } |
||
215 | } |
||
216 | if ($this->_subheader) { |
||
217 | $menu .= "<div class='admin_subheader'>" . $this->_subheader . "</div>\n"; |
||
218 | } |
||
219 | $menu .= '<div class="clear"> </div>'; |
||
220 | unset($this->_obj); |
||
221 | if ($display === true) { |
||
222 | echo $menu; |
||
223 | } else { |
||
224 | return $menu; |
||
225 | } |
||
226 | |||
227 | return null; |
||
228 | } |
||
230 |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.