| Conditions | 4 |
| Paths | 8 |
| Total Lines | 53 |
| Code Lines | 30 |
| 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 namespace XoopsModules\Mymenus; |
||
| 59 | public function getForm($action = false) |
||
| 60 | { |
||
| 61 | // $grouppermHandler = xoops_getHandler('groupperm'); |
||
| 62 | // |
||
| 63 | xoops_load('XoopsFormLoader'); |
||
| 64 | // |
||
| 65 | if (false === $action) { |
||
| 66 | // $action = $_SERVER['REQUEST_URI']; |
||
| 67 | $action = Request::getString('REQUEST_URI', '', 'SERVER'); |
||
| 68 | } |
||
| 69 | // |
||
| 70 | // $isAdmin = mymenusUserIsAdmin(); |
||
| 71 | // $groups = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : array(0 => XOOPS_GROUP_ANONYMOUS); |
||
| 72 | // |
||
| 73 | $title = $this->isNew() ? _AM_MYMENUS_MENUS_ADD : _AM_MYMENUS_MENUS_EDIT; |
||
| 74 | // |
||
| 75 | $form = new \XoopsThemeForm($title, 'moneusform', $action, 'post', true); |
||
| 76 | $form->setExtra('enctype="multipart/form-data"'); |
||
| 77 | // menus: title |
||
| 78 | $menusTitleText = new \XoopsFormText(_AM_MYMENUS_MENU_TITLE, 'title', 50, 255, $this->getVar('title', 'e')); |
||
| 79 | $menusTitleText->setDescription(_AM_MYMENUS_MENU_TITLE_DESC); |
||
| 80 | $form->addElement($menusTitleText, true); |
||
| 81 | // menus: css |
||
| 82 | $menusCssText = new \XoopsFormText(_AM_MYMENUS_MENU_CSS, 'css', 50, 255, $this->getVar('css', 'e')); |
||
| 83 | $menusCssText->setDescription(_AM_MYMENUS_MENU_CSS_DESC); |
||
| 84 | $form->addElement($menusCssText, false); |
||
| 85 | // form: button tray |
||
| 86 | $buttonTray = new \XoopsFormElementTray('', ''); |
||
| 87 | $buttonTray->addElement(new \XoopsFormHidden('op', 'save')); |
||
| 88 | // |
||
| 89 | $buttonSubmit = new \XoopsFormButton('', '', _SUBMIT, 'submit'); |
||
| 90 | $buttonSubmit->setExtra('onclick="this.form.elements.op.value=\'save\'"'); |
||
| 91 | $buttonTray->addElement($buttonSubmit); |
||
| 92 | if ($this->isNew()) { |
||
| 93 | // NOP |
||
| 94 | } else { |
||
| 95 | $form->addElement(new \XoopsFormHidden('id', (int)$this->getVar('id'))); |
||
| 96 | // |
||
| 97 | $buttonDelete = new \XoopsFormButton('', '', _DELETE, 'submit'); |
||
| 98 | $buttonDelete->setExtra('onclick="this.form.elements.op.value=\'delete\'"'); |
||
| 99 | $buttonTray->addElement($buttonDelete); |
||
| 100 | } |
||
| 101 | $buttonReset = new \XoopsFormButton('', '', _RESET, 'reset'); |
||
| 102 | $buttonTray->addElement($buttonReset); |
||
| 103 | // |
||
| 104 | $buttonCancel = new \XoopsFormButton('', '', _CANCEL, 'button'); |
||
| 105 | $buttonCancel->setExtra('onclick="history.go(-1)"'); |
||
| 106 | $buttonTray->addElement($buttonCancel); |
||
| 107 | // |
||
| 108 | $form->addElement($buttonTray); |
||
| 109 | |||
| 110 | // |
||
| 111 | return $form; |
||
| 112 | } |
||
| 114 |
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