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