| Conditions | 10 |
| Paths | 256 |
| Total Lines | 54 |
| 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 declare(strict_types=1); |
||
| 89 | public function getForm($action = false) |
||
| 90 | { |
||
| 91 | $helper = \XoopsModules\Wgevents\Helper::getInstance(); |
||
| 92 | if (!$action) { |
||
| 93 | $action = $_SERVER['REQUEST_URI']; |
||
| 94 | } |
||
| 95 | $isAdmin = (\is_object($GLOBALS['xoopsUser']) && \is_object($GLOBALS['xoopsModule'])) ? $GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid()) : false; |
||
| 96 | // Title |
||
| 97 | $title = $this->isNew() ? \_MA_WGEVENTS_ANSWER_ADD : \_MA_WGEVENTS_ANSWER_EDIT; |
||
| 98 | // Get Theme Form |
||
| 99 | \xoops_load('XoopsFormLoader'); |
||
| 100 | $form = new \XoopsThemeForm($title, 'form', $action, 'post', true); |
||
| 101 | $form->setExtra('enctype="multipart/form-data"'); |
||
| 102 | // Form Table registrations |
||
| 103 | $registrationHandler = $helper->getHandler('Registration'); |
||
| 104 | $ansResidSelect = new \XoopsFormSelect(\_MA_WGEVENTS_ANSWER_REGID, 'regid', $this->getVar('regid')); |
||
| 105 | $ansResidSelect->addOptionArray($registrationHandler->getList()); |
||
| 106 | $form->addElement($ansResidSelect); |
||
| 107 | // Form Table questions |
||
| 108 | $questionHandler = $helper->getHandler('Question'); |
||
| 109 | $ansAddidSelect = new \XoopsFormSelect(\_MA_WGEVENTS_ANSWER_QUEID, 'queid', $this->getVar('queid')); |
||
| 110 | $crQuestion = new \CriteriaCompo(); |
||
| 111 | $crQuestion->add(new \Criteria('evid', $this->getVar('evid'))); |
||
| 112 | $questionsCount = $questionHandler->getCount($crQuestion); |
||
| 113 | // Table view questions |
||
| 114 | if ($questionsCount > 0) { |
||
| 115 | $crQuestion->setSort('weight ASC, id'); |
||
| 116 | $crQuestion->setOrder('DESC'); |
||
| 117 | $questionsAll = $questionHandler->getAll($crQuestion); |
||
| 118 | foreach (\array_keys($questionsAll) as $i) { |
||
| 119 | $ansAddidSelect->addOption($questionsAll[$i]->getVar('id'), $questionsAll[$i]->getVar('caption')); |
||
| 120 | } |
||
| 121 | } |
||
| 122 | $form->addElement($ansAddidSelect); |
||
| 123 | // Form Table events |
||
| 124 | $eventHandler = $helper->getHandler('Event'); |
||
| 125 | $ansEvidSelect = new \XoopsFormSelect(\_MA_WGEVENTS_ANSWER_EVID, 'evid', $this->getVar('evid')); |
||
| 126 | $ansEvidSelect->addOptionArray($eventHandler->getList()); |
||
| 127 | $form->addElement($ansEvidSelect); |
||
| 128 | // Form Text ansText |
||
| 129 | $form->addElement(new \XoopsFormText(\_MA_WGEVENTS_ANSWER_TEXT, 'text', 50, 255, $this->getVar('text'))); |
||
| 130 | // Form Text Date Select ansDatecreated |
||
| 131 | $ansDatecreated = $this->isNew() ? \time() : $this->getVar('datecreated'); |
||
| 132 | $form->addElement(new \XoopsFormTextDateSelect(\_MA_WGEVENTS_DATECREATED, 'datecreated', '', $ansDatecreated)); |
||
| 133 | // Form Select User ansSubmitter |
||
| 134 | $uidCurrent = \is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->uid() : 0; |
||
| 135 | $ansSubmitter = $this->isNew() ? $uidCurrent : $this->getVar('submitter'); |
||
| 136 | $form->addElement(new \XoopsFormSelectUser(\_MA_WGEVENTS_SUBMITTER, 'submitter', false, $ansSubmitter)); |
||
| 137 | // To Save |
||
| 138 | $form->addElement(new \XoopsFormHidden('op', 'save')); |
||
| 139 | $form->addElement(new \XoopsFormHidden('start', $this->start)); |
||
| 140 | $form->addElement(new \XoopsFormHidden('limit', $this->limit)); |
||
| 141 | $form->addElement(new \XoopsFormButtonTray('', \_SUBMIT, 'submit', '', false)); |
||
| 142 | return $form; |
||
| 143 | } |
||
| 192 |
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