Conditions | 11 |
Paths | 768 |
Total Lines | 62 |
Code Lines | 40 |
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); |
||
90 | public function getForm($action = false) |
||
91 | { |
||
92 | $helper = Helper::getInstance(); |
||
93 | //$categoryHandler = $helper->getHandler('Category'); |
||
94 | $textblockHandler = $helper->getHandler('Textblock'); |
||
95 | |||
96 | if (!$action) { |
||
97 | $action = $_SERVER['REQUEST_URI']; |
||
98 | } |
||
99 | $isAdmin = (\is_object($GLOBALS['xoopsUser']) && \is_object($GLOBALS['xoopsModule'])) && $GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid()); |
||
100 | // Title |
||
101 | $title = $this->isNew() ? \_MA_WGEVENTS_TEXTBLOCK_ADD : \_MA_WGEVENTS_TEXTBLOCK_EDIT; |
||
102 | // Get Theme Form |
||
103 | \xoops_load('XoopsFormLoader'); |
||
104 | $form = new \XoopsThemeForm($title, 'formTextblock', $action, 'post', true); |
||
105 | $form->setExtra('enctype="multipart/form-data"'); |
||
106 | // Form Table categories |
||
107 | /* for the moment textblocks are valid for all categories |
||
108 | $evCatidSelect = new \XoopsFormSelect(\_MA_WGEVENTS_EVENT_CATID, 'catid', $this->getVar('catid')); |
||
109 | $evCatidSelect->addOptionArray($categoryHandler->getList()); |
||
110 | $form->addElement($evCatidSelect); |
||
111 | */ |
||
112 | // Form Text tbName |
||
113 | $form->addElement(new \XoopsFormText(\_MA_WGEVENTS_TEXTBLOCK_NAME, 'name', 50, 255, $this->getVar('name'))); |
||
114 | // Form Editor DhtmlTextArea tbText |
||
115 | $editorConfigs = []; |
||
116 | if ($isAdmin) { |
||
117 | $editor = $helper->getConfig('editor_admin'); |
||
118 | } else { |
||
119 | $editor = $helper->getConfig('editor_user'); |
||
120 | } |
||
121 | $editorConfigs['name'] = 'text'; |
||
122 | $editorConfigs['value'] = $this->getVar('text', 'e'); |
||
123 | $editorConfigs['rows'] = 5; |
||
124 | $editorConfigs['cols'] = 40; |
||
125 | $editorConfigs['width'] = '100%'; |
||
126 | $editorConfigs['height'] = '400px'; |
||
127 | $editorConfigs['editor'] = $editor; |
||
128 | $form->addElement(new \XoopsFormEditor(\_MA_WGEVENTS_TEXTBLOCK_TEXT, 'text', $editorConfigs)); |
||
129 | // Form select tbClass |
||
130 | $tbClass = $this->isNew() ? Constants::TEXTBLOCK_CLASS_PRIVATE : $this->getVar('class'); |
||
131 | $tbclassSelect = new \XoopsFormSelect(\_MA_WGEVENTS_TEXTBLOCK_CLASS, 'class', $tbClass); |
||
132 | $tbclassSelect->addOption(Constants::TEXTBLOCK_CLASS_PRIVATE, \_MA_WGEVENTS_TEXTBLOCK_CLASS_PRIVATE); |
||
133 | $tbclassSelect->addOption(Constants::TEXTBLOCK_CLASS_PUBLIC, \_MA_WGEVENTS_TEXTBLOCK_CLASS_PUBLIC); |
||
134 | $form->addElement($tbclassSelect); |
||
135 | // Form Text tbWeight |
||
136 | $tbWeight = $this->isNew() ? $textblockHandler->getNextWeight() : $this->getVar('weight'); |
||
137 | $form->addElement(new \XoopsFormText(\_MA_WGEVENTS_WEIGHT, 'weight', 50, 255, $tbWeight)); |
||
138 | // Form Text Date Select tbDatecreated |
||
139 | $tbDatecreated = $this->isNew() ? \time() : $this->getVar('datecreated'); |
||
140 | $form->addElement(new \XoopsFormTextDateSelect(\_MA_WGEVENTS_DATECREATED, 'datecreated', '', $tbDatecreated)); |
||
141 | // Form Select User tbSubmitter |
||
142 | $uidCurrent = \is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->uid() : 0; |
||
143 | $tbSubmitter = $this->isNew() ? $uidCurrent : $this->getVar('submitter'); |
||
144 | $form->addElement(new \XoopsFormSelectUser(\_MA_WGEVENTS_SUBMITTER, 'submitter', false, $tbSubmitter)); |
||
145 | |||
146 | // To Save |
||
147 | $form->addElement(new \XoopsFormHidden('op', 'save')); |
||
148 | $form->addElement(new \XoopsFormHidden('start', $this->start)); |
||
149 | $form->addElement(new \XoopsFormHidden('limit', $this->limit)); |
||
150 | $form->addElement(new \XoopsFormButtonTray('', \_SUBMIT, 'submit', '', false)); |
||
151 | return $form; |
||
152 | } |
||
200 |
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