| Conditions | 9 |
| Paths | 16 |
| Total Lines | 64 |
| Code Lines | 46 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
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 |
||
| 86 | public function getFormDirectories($action = false, $start = 0, $limit = 0) |
||
| 87 | {
|
||
| 88 | $helper = \XoopsModules\Wggithub\Helper::getInstance(); |
||
| 89 | if (!$action) {
|
||
| 90 | $action = $_SERVER['REQUEST_URI']; |
||
| 91 | } |
||
| 92 | $isAdmin = $GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid()); |
||
| 93 | |||
| 94 | // Title |
||
| 95 | $title = $this->isNew() ? \sprintf(\_AM_WGGITHUB_DIRECTORY_ADD) : \sprintf(\_AM_WGGITHUB_DIRECTORY_EDIT); |
||
| 96 | // Get Theme Form |
||
| 97 | \xoops_load('XoopsFormLoader');
|
||
| 98 | $form = new \XoopsThemeForm($title, 'form', $action, 'post', true); |
||
| 99 | $form->setExtra('enctype="multipart/form-data"');
|
||
| 100 | // Form Text dirName |
||
| 101 | $form->addElement(new \XoopsFormText(\_AM_WGGITHUB_DIRECTORY_NAME, 'dir_name', 50, 255, $this->getVar('dir_name')), true);
|
||
| 102 | // Form Editor DhtmlTextArea dirDescr |
||
| 103 | $editorConfigs = []; |
||
| 104 | if ($isAdmin) {
|
||
| 105 | $editor = $helper->getConfig('editor_admin');
|
||
| 106 | } else {
|
||
| 107 | $editor = $helper->getConfig('editor_user');
|
||
| 108 | } |
||
| 109 | $editorConfigs['name'] = 'dir_descr'; |
||
| 110 | $editorConfigs['value'] = $this->getVar('dir_descr', 'e');
|
||
| 111 | $editorConfigs['rows'] = 5; |
||
| 112 | $editorConfigs['cols'] = 40; |
||
| 113 | $editorConfigs['width'] = '100%'; |
||
| 114 | $editorConfigs['height'] = '400px'; |
||
| 115 | $editorConfigs['editor'] = $editor; |
||
| 116 | $form->addElement(new \XoopsFormEditor(\_AM_WGGITHUB_DIRECTORY_DESCR, 'dir_descr', $editorConfigs)); |
||
| 117 | // Form Select dirType |
||
| 118 | $dirTypeSelect = new \XoopsFormSelect(\_AM_WGGITHUB_DIRECTORY_TYPE, 'dir_type', $this->getVar('dir_type'), 5);
|
||
| 119 | $dirTypeSelect->addOption(Constants::DIRECTORY_TYPE_USER, \_AM_WGGITHUB_DIRECTORY_TYPE_USER); |
||
| 120 | $dirTypeSelect->addOption(Constants::DIRECTORY_TYPE_ORG, \_AM_WGGITHUB_DIRECTORY_TYPE_ORG); |
||
| 121 | $form->addElement($dirTypeSelect, true); |
||
| 122 | // Form Select dirContent |
||
| 123 | $dirContentSelect = new \XoopsFormSelect(\_AM_WGGITHUB_DIRECTORY_CONTENT, 'dir_content', $this->getVar('dir_content'), 3);
|
||
| 124 | $dirContentSelect->addOption(Constants::DIRECTORY_CONTENT_ALL, \_AM_WGGITHUB_DIRECTORY_CONTENT_ALL); |
||
| 125 | $dirContentSelect->addOption(Constants::DIRECTORY_CONTENT_OWN, \_AM_WGGITHUB_DIRECTORY_CONTENT_OWN); |
||
| 126 | $form->addElement($dirContentSelect, true); |
||
| 127 | // Form Radio Yes/No dirAutoupdate |
||
| 128 | $dirAutoupdate = $this->isNew() ?: $this->getVar('dir_autoupdate');
|
||
| 129 | $form->addElement(new \XoopsFormRadioYN(\_AM_WGGITHUB_DIRECTORY_AUTOUPDATE, 'dir_autoupdate', $dirAutoupdate)); |
||
| 130 | // Form Radio Yes/No dirOnline |
||
| 131 | $dirOnline = $this->isNew() ?: $this->getVar('dir_online');
|
||
| 132 | $form->addElement(new \XoopsFormRadioYN(\_AM_WGGITHUB_DIRECTORY_ONLINE, 'dir_online', $dirOnline)); |
||
| 133 | // Form Select dirFilterrelease |
||
| 134 | $dirFilterrelease = $this->isNew() ?: $this->getVar('dir_filterrelease');
|
||
| 135 | $form->addElement(new \XoopsFormRadioYN(\_AM_WGGITHUB_DIRECTORY_FILTERRELEASE, 'dir_filterrelease', $dirFilterrelease)); |
||
| 136 | // Form Text dirWeight |
||
| 137 | $dirWeight = $this->isNew() ? 0 : $this->getVar('dir_weight');
|
||
| 138 | $form->addElement(new \XoopsFormText(\_AM_WGGITHUB_DIRECTORY_WEIGHT, 'dir_weight', 50, 255, $dirWeight), true); |
||
| 139 | // Form Text Date Select dirDatecreated |
||
| 140 | $dirDatecreated = $this->isNew() ?: $this->getVar('dir_datecreated');
|
||
| 141 | $form->addElement(new \XoopsFormTextDateSelect(\_AM_WGGITHUB_DIRECTORY_DATECREATED, 'dir_datecreated', '', $dirDatecreated)); |
||
| 142 | // Form Select User dirSubmitter |
||
| 143 | $form->addElement(new \XoopsFormSelectUser(\_AM_WGGITHUB_DIRECTORY_SUBMITTER, 'dir_submitter', false, $this->getVar('dir_submitter')));
|
||
| 144 | // To Save |
||
| 145 | $form->addElement(new \XoopsFormHidden('op', 'save'));
|
||
| 146 | $form->addElement(new \XoopsFormHidden('start', $start));
|
||
| 147 | $form->addElement(new \XoopsFormHidden('limit', $limit));
|
||
| 148 | $form->addElement(new \XoopsFormButtonTray('', \_SUBMIT, 'submit', '', false));
|
||
| 149 | return $form; |
||
| 150 | } |
||
| 203 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths