| Conditions | 1 |
| Paths | 1 |
| Total Lines | 64 |
| Code Lines | 43 |
| 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 |
||
| 19 | function getConfig() |
||
| 20 | { |
||
| 21 | $moduleDirName = basename(dirname(__DIR__)); |
||
| 22 | $moduleDirNameUpper = mb_strtoupper($moduleDirName); |
||
| 23 | |||
| 24 | return (object)[ |
||
| 25 | 'name' => mb_strtoupper($moduleDirName) . ' Module Configurator', |
||
| 26 | 'paths' => [ |
||
| 27 | 'dirname' => $moduleDirName, |
||
| 28 | 'admin' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin', |
||
| 29 | 'modPath' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName, |
||
| 30 | 'modUrl' => XOOPS_URL . '/modules/' . $moduleDirName, |
||
| 31 | 'uploadPath' => XOOPS_UPLOAD_PATH . '/' . $moduleDirName, |
||
| 32 | 'uploadUrl' => XOOPS_UPLOAD_URL . '/' . $moduleDirName, |
||
| 33 | ], |
||
| 34 | 'uploadFolders' => [ |
||
| 35 | XOOPS_UPLOAD_PATH . '/' . $moduleDirName, |
||
| 36 | XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/category', |
||
| 37 | XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/screenshots', |
||
| 38 | XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/thumbs', |
||
| 39 | XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/midsize', |
||
| 40 | //XOOPS_UPLOAD_PATH . '/flags' |
||
| 41 | ], |
||
| 42 | 'copyBlankFiles' => [ |
||
| 43 | XOOPS_UPLOAD_PATH . '/' . $moduleDirName, |
||
| 44 | XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/category', |
||
| 45 | XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/screenshots', |
||
| 46 | XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/thumbs', |
||
| 47 | XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/midsize', |
||
| 48 | //XOOPS_UPLOAD_PATH . '/flags' |
||
| 49 | ], |
||
| 50 | |||
| 51 | 'copyTestFolders' => [ |
||
| 52 | //[ |
||
| 53 | // constant($moduleDirNameUpper . '_PATH') . '/testdata/images', |
||
| 54 | // XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/images', |
||
| 55 | //] |
||
| 56 | ], |
||
| 57 | |||
| 58 | 'templateFolders' => [ |
||
| 59 | '/templates/', |
||
| 60 | '/templates/blocks/', |
||
| 61 | '/templates/admin/', |
||
| 62 | ], |
||
| 63 | 'oldFiles' => [ |
||
| 64 | '/class/request.php', |
||
| 65 | '/class/registry.php', |
||
| 66 | '/class/utilities.php', |
||
| 67 | '/class/util.php', |
||
| 68 | // '/include/constants.php', |
||
| 69 | // '/include/functions.php', |
||
| 70 | '/ajaxrating.txt', |
||
| 71 | ], |
||
| 72 | 'oldFolders' => [ |
||
| 73 | '/images', |
||
| 74 | '/css', |
||
| 75 | '/js', |
||
| 76 | '/tcpdf', |
||
| 77 | '/images', |
||
| 78 | ], |
||
| 79 | 'renameTables' => [// 'XX_archive' => 'ZZZZ_archive', |
||
| 80 | ], |
||
| 81 | 'modCopyright' => "<a href='https://xoops.org' title='XOOPS Project' target='_blank'> |
||
| 82 | <img src='" . constant($moduleDirNameUpper . '_AUTHOR_LOGOIMG') . '\' alt=\'XOOPS Project\' /></a>', |
||
| 83 | ]; |
||
| 85 |