| Conditions | 16 | 
| Paths | 192 | 
| Total Lines | 90 | 
| Code Lines | 57 | 
| 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  | 
            ||
| 265 | public function renderIndex()  | 
            ||
| 266 |     { | 
            ||
| 267 | global $xoops, $xoopsTpl;  | 
            ||
| 268 | |||
| 269 | $this->addAssets();  | 
            ||
| 270 |         $path = XOOPS_URL . '/modules/' . $this->_obj->getVar('dirname') . '/'; | 
            ||
| 271 | $pathsystem = XOOPS_URL . '/modules/system/';  | 
            ||
| 272 | |||
| 273 | $this->_obj->loadAdminMenu();  | 
            ||
| 274 | |||
| 275 | // Help page  | 
            ||
| 276 |         if ($this->_obj->getInfo('help')) { | 
            ||
| 277 |             $icons = xoops_getModuleOption('typeicons', 'system'); | 
            ||
| 278 |             if ($icons == '') { | 
            ||
| 279 | $icons = 'default';  | 
            ||
| 280 | }  | 
            ||
| 281 |             $xoopsTpl->assign('helpurl',$xoops->url('modules/system/help.php?mid=' . $this->_obj->getVar('mid', 's') . '&page=' . $this->_obj->getInfo('help'))); | 
            ||
| 282 |             $xoopsTpl->assign('helpicon', $xoops->url('modules/system/images/icons/' . $icons . '/help.png')); | 
            ||
| 283 |             $xoopsTpl->assign('help', $this->_obj->getInfo('help')); | 
            ||
| 284 | }  | 
            ||
| 285 | |||
| 286 | // Menu  | 
            ||
| 287 |         $xoopsTpl->assign('path', $path); | 
            ||
| 288 |         $xoopsTpl->assign('modulenmenu', $this->_obj->adminmenu); | 
            ||
| 289 | |||
| 290 | // Info Box  | 
            ||
| 291 |         if ($this->_obj->getInfo('min_php') || $this->_obj->getInfo('min_xoops') || !empty($this->_itemConfigBoxLine)) { | 
            ||
| 292 | |||
| 293 | // PHP version  | 
            ||
| 294 |             if ($this->_obj->getInfo('min_php')) { | 
            ||
| 295 |                 if (version_compare(phpversion(), strtolower($this->_obj->getInfo('min_php')), '<')) { | 
            ||
| 296 |                     $this->addConfigBoxLine( sprintf(_AM_MODULEADMIN_CONFIG_PHP, $this->_obj->getInfo('min_php'), phpversion()), 'error'); | 
            ||
| 297 |                 } else { | 
            ||
| 298 |                     $this->addConfigBoxLine( sprintf(_AM_MODULEADMIN_CONFIG_PHP, $this->_obj->getInfo('min_php'), phpversion()), 'success'); | 
            ||
| 299 | }  | 
            ||
| 300 | }  | 
            ||
| 301 | |||
| 302 | // Database version  | 
            ||
| 303 |             $dbarray = $this->_obj->getInfo('min_db'); | 
            ||
| 304 |             if ($dbarray!=false) { | 
            ||
| 305 | // changes from redheadedrod to use connector specific version info  | 
            ||
| 306 |                 switch (XOOPS_DB_TYPE) { | 
            ||
| 307 | // server should be the same in both cases  | 
            ||
| 308 | case 'mysql':  | 
            ||
| 309 | case 'mysqli':  | 
            ||
| 310 | global $xoopsDB;  | 
            ||
| 311 | $dbCurrentVersion = $xoopsDB->getServerVersion();  | 
            ||
| 312 | break;  | 
            ||
| 313 | default: // don't really support anything other than mysql  | 
            ||
| 314 | $dbCurrentVersion = '0';  | 
            ||
| 315 | break;  | 
            ||
| 316 | }  | 
            ||
| 317 |                 $currentVerParts   = explode('.', (string)$dbCurrentVersion); | 
            ||
| 318 |                 $iCurrentVerParts  = array_map('intval', $currentVerParts); | 
            ||
| 319 | $dbRequiredVersion = $dbarray[XOOPS_DB_TYPE];  | 
            ||
| 320 |                 $reqVerParts       = explode('.', (string)$dbRequiredVersion); | 
            ||
| 321 |                 $iReqVerParts      = array_map('intval', $reqVerParts); | 
            ||
| 322 | $icount = $j = count($iReqVerParts);  | 
            ||
| 323 | $reqVer = $curVer = 0;  | 
            ||
| 324 |                 for ($i = 0; $i < $icount; ++$i) { | 
            ||
| 325 | $j--;  | 
            ||
| 326 | $reqVer += $iReqVerParts[$i] * 10 ** $j;  | 
            ||
| 327 |                     if (isset($iCurrentVerParts[$i])) { | 
            ||
| 328 | $curVer += $iCurrentVerParts[$i] * 10 ** $j;  | 
            ||
| 329 |                     } else { | 
            ||
| 330 | $curVer *= 10 ** $j;  | 
            ||
| 331 | }  | 
            ||
| 332 | }  | 
            ||
| 333 |                 if ($reqVer > $curVer) { | 
            ||
| 334 | $this->addConfigBoxLine( sprintf(XOOPS_DB_TYPE . ' ' . _AM_MODULEADMIN_CONFIG_DB, $dbRequiredVersion, $dbCurrentVersion), 'error');  | 
            ||
| 335 |                 } else { | 
            ||
| 336 | $this->addConfigBoxLine( sprintf(XOOPS_DB_TYPE . ' ' . _AM_MODULEADMIN_CONFIG_DB, $dbRequiredVersion, $dbCurrentVersion), 'success');  | 
            ||
| 337 | }  | 
            ||
| 338 | }  | 
            ||
| 339 | |||
| 340 | // Xoops version  | 
            ||
| 341 |             if ($this->_obj->getInfo('min_xoops')) { | 
            ||
| 342 |                 $currentXoopsVersion = strtolower(str_replace('XOOPS ', '', XOOPS_VERSION)); | 
            ||
| 343 |                 if ($this->_obj->versionCompare($currentXoopsVersion, strtolower($this->_obj->getInfo('min_xoops')), '<')) { | 
            ||
| 344 |                     $this->addConfigBoxLine( sprintf(_AM_MODULEADMIN_CONFIG_XOOPS, $this->_obj->getInfo('min_xoops'), substr(XOOPS_VERSION, 6, strlen(XOOPS_VERSION) - 6)), 'error'); | 
            ||
| 345 |                 } else { | 
            ||
| 346 |                     $this->addConfigBoxLine( sprintf(_AM_MODULEADMIN_CONFIG_XOOPS, $this->_obj->getInfo('min_xoops'), substr(XOOPS_VERSION, 6)), 'success'); | 
            ||
| 347 | }  | 
            ||
| 348 | }  | 
            ||
| 349 | |||
| 350 |             $xoopsTpl->assign('ret_info', $this->_itemConfigBoxLine); | 
            ||
| 351 | }  | 
            ||
| 352 | |||
| 353 | // Display page  | 
            ||
| 354 |         $xoopsTpl->display('db:system_modules_index.tpl'); | 
            ||
| 355 | }  | 
            ||
| 356 | }  |