| Conditions | 8 |
| Paths | 8 |
| Total Lines | 61 |
| Code Lines | 44 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 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 |
||
| 85 | public function getFormDirectories($action = false, $start = 0, $limit = 0) |
||
| 86 | { |
||
| 87 | $helper = \XoopsModules\Wggithub\Helper::getInstance(); |
||
| 88 | if (!$action) { |
||
| 89 | $action = $_SERVER['REQUEST_URI']; |
||
| 90 | } |
||
| 91 | $isAdmin = $GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid()); |
||
| 92 | |||
| 93 | // Title |
||
| 94 | $title = $this->isNew() ? \sprintf(\_AM_WGGITHUB_DIRECTORY_ADD) : \sprintf(\_AM_WGGITHUB_DIRECTORY_EDIT); |
||
| 95 | // Get Theme Form |
||
| 96 | \xoops_load('XoopsFormLoader'); |
||
| 97 | $form = new \XoopsThemeForm($title, 'form', $action, 'post', true); |
||
| 98 | $form->setExtra('enctype="multipart/form-data"'); |
||
| 99 | // Form Text dirName |
||
| 100 | $form->addElement(new \XoopsFormText(\_AM_WGGITHUB_DIRECTORY_NAME, 'dir_name', 50, 255, $this->getVar('dir_name')), true); |
||
| 101 | // Form Editor DhtmlTextArea dirDescr |
||
| 102 | $editorConfigs = []; |
||
| 103 | if ($isAdmin) { |
||
| 104 | $editor = $helper->getConfig('editor_admin'); |
||
| 105 | } else { |
||
| 106 | $editor = $helper->getConfig('editor_user'); |
||
| 107 | } |
||
| 108 | $editorConfigs['name'] = 'dir_descr'; |
||
| 109 | $editorConfigs['value'] = $this->getVar('dir_descr', 'e'); |
||
| 110 | $editorConfigs['rows'] = 5; |
||
| 111 | $editorConfigs['cols'] = 40; |
||
| 112 | $editorConfigs['width'] = '100%'; |
||
| 113 | $editorConfigs['height'] = '400px'; |
||
| 114 | $editorConfigs['editor'] = $editor; |
||
| 115 | $form->addElement(new \XoopsFormEditor(_AM_WGGITHUB_DIRECTORY_DESCR, 'dir_descr', $editorConfigs)); |
||
| 116 | // Form Select dirType |
||
| 117 | $dirTypeSelect = new \XoopsFormSelect(\_AM_WGGITHUB_DIRECTORY_TYPE, 'dir_type', $this->getVar('dir_type'), 5); |
||
| 118 | $dirTypeSelect->addOption(Constants::DIRECTORY_TYPE_USER, \_AM_WGGITHUB_DIRECTORY_TYPE_USER); |
||
| 119 | $dirTypeSelect->addOption(Constants::DIRECTORY_TYPE_ORG, \_AM_WGGITHUB_DIRECTORY_TYPE_ORG); |
||
| 120 | $form->addElement($dirTypeSelect, true); |
||
| 121 | // Form Select dirContent |
||
| 122 | $dirContentSelect = new \XoopsFormSelect(\_AM_WGGITHUB_DIRECTORY_CONTENT, 'dir_content', $this->getVar('dir_content'), 3); |
||
| 123 | $dirContentSelect->addOption(Constants::DIRECTORY_CONTENT_ALL, \_AM_WGGITHUB_DIRECTORY_CONTENT_ALL); |
||
| 124 | $dirContentSelect->addOption(Constants::DIRECTORY_CONTENT_OWN, \_AM_WGGITHUB_DIRECTORY_CONTENT_OWN); |
||
| 125 | $form->addElement($dirContentSelect, true); |
||
| 126 | // Form Radio Yes/No dirAutoupdate |
||
| 127 | $dirAutoupdate = $this->isNew() ?: $this->getVar('dir_autoupdate'); |
||
| 128 | $form->addElement(new \XoopsFormRadioYN(_AM_WGGITHUB_DIRECTORY_AUTOUPDATE, 'dir_autoupdate', $dirAutoupdate)); |
||
| 129 | // Form Radio Yes/No dirOnline |
||
| 130 | $dirOnline = $this->isNew() ?: $this->getVar('dir_online'); |
||
| 131 | $form->addElement(new \XoopsFormRadioYN(_AM_WGGITHUB_DIRECTORY_ONLINE, 'dir_online', $dirOnline)); |
||
| 132 | // Form Radio Yes/No dirFilterrelease |
||
| 133 | $dirFilterrelease = $this->isNew() ?: $this->getVar('dir_filterrelease'); |
||
| 134 | $form->addElement(new \XoopsFormRadioYN(_AM_WGGITHUB_DIRECTORY_FILTERRELEASE, 'dir_filterrelease', $dirFilterrelease)); |
||
| 135 | // Form Text Date Select dirDatecreated |
||
| 136 | $dirDatecreated = $this->isNew() ?: $this->getVar('dir_datecreated'); |
||
| 137 | $form->addElement(new \XoopsFormTextDateSelect(\_AM_WGGITHUB_DIRECTORY_DATECREATED, 'dir_datecreated', '', $dirDatecreated)); |
||
| 138 | // Form Select User dirSubmitter |
||
| 139 | $form->addElement(new \XoopsFormSelectUser(\_AM_WGGITHUB_DIRECTORY_SUBMITTER, 'dir_submitter', false, $this->getVar('dir_submitter'))); |
||
| 140 | // To Save |
||
| 141 | $form->addElement(new \XoopsFormHidden('op', 'save')); |
||
| 142 | $form->addElement(new \XoopsFormHidden('start', $start)); |
||
| 143 | $form->addElement(new \XoopsFormHidden('limit', $limit)); |
||
| 144 | $form->addElement(new \XoopsFormButtonTray('', _SUBMIT, 'submit', '', false)); |
||
| 145 | return $form; |
||
| 146 | } |
||
| 198 |
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