| Conditions | 4 |
| Paths | 8 |
| Total Lines | 96 |
| Code Lines | 39 |
| 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\Pedigree; |
||
| 64 | public function getForm($action = false) |
||
| 65 | { |
||
| 66 | if (false === $action) { |
||
| 67 | $action = $_SERVER['REQUEST_URI']; |
||
| 68 | } |
||
| 69 | |||
| 70 | $title = $this->isNew() ? sprintf(_AM_PEDIGREE_PEDIGREE_CONFIG_ADD) : sprintf(_AM_PEDIGREE_PEDIGREE_CONFIG_EDIT); |
||
| 71 | |||
| 72 | require_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); |
||
| 73 | |||
| 74 | $form = new \XoopsThemeForm($title, 'form', $action, 'post', true); |
||
| 75 | $form->setExtra('enctype="multipart/form-data"'); |
||
| 76 | |||
| 77 | $form->addElement(new \XoopsFormText(_AM_PEDIGREE_PEDIGREE_CONFIG_FIELDNAME, 'fieldName', 50, 255, $this->getVar('FieldName')), true); |
||
| 78 | $form->addElement(new \XoopsFormRadioYN(_AM_PEDIGREE_PEDIGREE_CONFIG_ISACTIVE, 'isActive', (int)$this->getVar('isActive')), false); |
||
| 79 | $fieldTypes = new \XoopsFormSelect(_AM_PEDIGREE_PEDIGREE_CONFIG_FIELDTYPE, 'fieldType', $this->getVar('FieldType'), false); |
||
| 80 | $fieldTypes->addOptionArray([ |
||
| 81 | 'DateSelect' => 'DateSelect', |
||
| 82 | 'Picture' => 'Picture', |
||
| 83 | 'radiobutton' => 'radiobutton', |
||
| 84 | 'selectbox' => 'selectbox', |
||
| 85 | 'textarea' => 'textarea', |
||
| 86 | 'textbox' => 'textbox', |
||
| 87 | 'urlfield' => 'urlfield' |
||
| 88 | ]); |
||
| 89 | $form->addElement($fieldTypes); |
||
| 90 | // $form->addElement(new \XoopsFormTextArea(_AM_PEDIGREE_PEDIGREE_CONFIG_FIELDTYPE, "FieldType", $this->getVar("FieldType"), 4, 47), false); |
||
| 91 | $form->addElement(new \XoopsFormText(_AM_PEDIGREE_PEDIGREE_CONFIG_LOOKUPTABLE, 'lookupTable', 50, 255, $this->getVar('LookupTable')), false); |
||
| 92 | $form->addElement(new \XoopsFormText(_AM_PEDIGREE_PEDIGREE_CONFIG_DEFAULTVALUE, 'defaultValue', 50, 255, $this->getVar('DefaultValue')), false); |
||
| 93 | $form->addElement(new \XoopsFormText(_AM_PEDIGREE_PEDIGREE_CONFIG_FIELDEXPLANATION, 'fieldExplanation', 50, 255, $this->getVar('FieldExplanation')), false); |
||
| 94 | $form->addElement(new \XoopsFormRadioYN(_AM_PEDIGREE_PEDIGREE_CONFIG_HASSEARCH, 'hasSearch', (int)$this->getVar('HasSearch')), false); |
||
| 95 | /* @todo: should be single select for either General Litter or Litter, can't have both */ |
||
| 96 | $currentType = $this->getVar('litter') ? 'litter' : 'generallitter'; |
||
| 97 | $litterRadio = new \XoopsFormRadio(_AM_PEDIGREE_PEDIGREE_CONFIG_LITTER_TYPE, 'litterType', $currentType); |
||
| 98 | $litterRadio->addOptionArray([ |
||
| 99 | 'litter' => _AM_PEDIGREE_PEDIGREE_CONFIG_LITTER, |
||
| 100 | 'generallitter' => _AM_PEDIGREE_PEDIGREE_CONFIG_GENERALLITTER |
||
| 101 | ]); |
||
| 102 | $form->addElement($litterRadio, false); |
||
| 103 | // $form->addElement(new \XoopsFormRadioYN(_AM_PEDIGREE_PEDIGREE_CONFIG_LITTER, "Litter", $this->getVar("Litter")), false); |
||
| 104 | // $form->addElement(new \XoopsFormRadioYN(_AM_PEDIGREE_PEDIGREE_CONFIG_GENERALLITTER, "Generallitter", $this->getVar("Generallitter")), false); |
||
| 105 | $form->addElement(new \XoopsFormText(_AM_PEDIGREE_PEDIGREE_CONFIG_SEARCHNAME, 'searchName', 50, 255, $this->getVar('SearchName')), false); |
||
| 106 | $form->addElement(new \XoopsFormText(_AM_PEDIGREE_PEDIGREE_CONFIG_SEARCHEXPLANATION, 'searchExplanation', 50, 255, $this->getVar('SearchExplanation')), false); |
||
| 107 | $form->addElement(new \XoopsFormRadioYN(_AM_PEDIGREE_PEDIGREE_CONFIG_VIEWINPEDIGREE, 'viewInPedigree', (int)$this->getVar('viewinpedigree')), false); |
||
| 108 | $form->addElement(new \XoopsFormRadioYN(_AM_PEDIGREE_PEDIGREE_CONFIG_VIEWINADVANCED, 'viewInAdvanced', (int)$this->getVar('ViewInAdvanced')), false); |
||
| 109 | $form->addElement(new \XoopsFormRadioYN(_AM_PEDIGREE_PEDIGREE_CONFIG_VIEWINPIE, 'viewInPie', (int)$this->getVar('ViewInPie')), false); |
||
| 110 | $form->addElement(new \XoopsFormRadioYN(_AM_PEDIGREE_PEDIGREE_CONFIG_VIEWINLIST, 'viewInList', (int)$this->getVar('ViewInList')), false); |
||
| 111 | $form->addElement(new \XoopsFormRadioYN(_AM_PEDIGREE_PEDIGREE_CONFIG_LOCKED, 'locked', (int)$this->getVar('locked')), false); |
||
| 112 | $form->addElement(new \XoopsFormText(_AM_PEDIGREE_PEDIGREE_CONFIG_ORDER, 'order', 3, 8, (int)$this->getVar('order')), false); |
||
| 113 | // include_once(XOOPS_ROOT_PATH."/class/tree.php"); |
||
| 114 | // $Handler = xoops_getModuleHandler("animal_", $GLOBALS['xoopsDB']->getVar("dirname")); |
||
| 115 | // $criteria = new \CriteriaCompo(); |
||
| 116 | // $criteria->setSort('_id'); |
||
| 117 | // $criteria->setOrder('ASC'); |
||
| 118 | // $_arr = $Handler->getAll(); |
||
| 119 | // $mytree = new \XoopsObjectTree($_arr, "_id", "_pid"); |
||
| 120 | // $form->addElement(new \XoopsFormLabel(_AM_PEDIGREE_PEDIGREE_CONFIG_LOCKED, $mytree->makeSelBox("_pid", "_title","--", $this->getVar("_pid"),false))); |
||
| 121 | // |
||
| 122 | // include_once(XOOPS_ROOT_PATH."/class/tree.php"); |
||
| 123 | // $Handler = xoops_getModuleHandler("animal_", $GLOBALS['xoopsModule']->getVar("dirname")); |
||
| 124 | // $criteria = new \CriteriaCompo(); |
||
| 125 | // $criteria->setSort('_id'); |
||
| 126 | // $criteria->setOrder('ASC'); |
||
| 127 | // $_arr = $Handler->getAll(); |
||
| 128 | // $mytree = new \XoopsObjectTree($_arr, "_id", "_pid"); |
||
| 129 | // $form->addElement(new \XoopsFormLabel(_AM_PEDIGREE_PEDIGREE_CONFIG_ORDER, $mytree->makeSelBox("_pid", "_title","--", $this->getVar("_pid"),false))); |
||
| 130 | /* |
||
| 131 | require_once $GLOBALS['xoops']->path("class/tree.php"); |
||
| 132 | // $Handler = xoops_getModuleHandler("animal_", $GLOBALS['xoopsModule']->getVar("dirname")); |
||
| 133 | $Handler = Pedigree\Helper::getInstance()->getHandler('Fields'); |
||
| 134 | // $Handler = & $fieldsHandler; |
||
| 135 | $criteria = new \CriteriaCompo(); |
||
| 136 | $criteria->setSort('id'); |
||
| 137 | $criteria->setOrder('ASC'); |
||
| 138 | $_arr = $Handler->getAll(); |
||
| 139 | $mytree = new \XoopsObjectTree($_arr, "ID", "_pid"); |
||
| 140 | $form->addElement(new \XoopsFormLabel(_AM_PEDIGREE_PEDIGREE_CONFIG_LOCKED, $mytree->makeSelBox("_pid", "_title", "--", $this->getVar("_pid"), false))); |
||
| 141 | */ |
||
| 142 | $form->addElement(new \XoopsFormHidden('op', 'save_pedigree_config')); |
||
| 143 | |||
| 144 | //Submit buttons |
||
| 145 | $form->addElement(new \XoopsFormButtonTray('fieldButtons', _SUBMIT, 'submit')); |
||
| 146 | |||
| 147 | /* |
||
| 148 | $button_tray = new \XoopsFormElementTray("", ""); |
||
| 149 | $submit_button = new \XoopsFormButton("", "submit", _SUBMIT, "submit"); |
||
| 150 | $button_tray->addElement($submit_button); |
||
| 151 | |||
| 152 | $cancel_button = new \XoopsFormButton("", "", _CANCEL, "cancel"); |
||
| 153 | $cancel_button->setExtra('onclick="history.go(-1)"'); |
||
| 154 | $button_tray->addElement($cancel_button); |
||
| 155 | |||
| 156 | $form->addElement($button_tray); |
||
| 157 | */ |
||
| 158 | |||
| 159 | return $form; |
||
| 160 | } |
||
| 271 |
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