| Conditions | 2 |
| Paths | 2 |
| Total Lines | 63 |
| 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 |
||
| 31 | public function __construct($obj = null) |
||
| 32 | { |
||
| 33 | $this->xoopsObject = $obj; |
||
| 34 | |||
| 35 | $helper = \XoopsModules\Xoosocialnetwork\Helper::getInstance(); |
||
| 36 | $socialnetworkHandler = $helper->getHandler('Socialnetwork'); |
||
| 37 | |||
| 38 | if ($this->xoopsObject->isNew()) { |
||
| 39 | parent::__construct('', 'form_socialnetwork', 'index.php', 'post', true); |
||
| 40 | } else { |
||
| 41 | parent::__construct('', 'form_socialnetwork', 'index.php', 'post', true); |
||
| 42 | } |
||
| 43 | $this->setExtra('enctype="multipart/form-data"'); |
||
| 44 | |||
| 45 | // Title |
||
| 46 | $this->addElement(new \Xoops\Form\Text(_AM_XOO_SN_TITLE, 'xoosocialnetwork_title', 5, 255, $this->xoopsObject->getVar('xoosocialnetwork_title')), true); |
||
| 47 | |||
| 48 | // Url |
||
| 49 | $this->addElement(new \Xoops\Form\Text(_AM_XOO_SN_URL, 'xoosocialnetwork_url', 7, 255, $this->xoopsObject->getVar('xoosocialnetwork_url')), true); |
||
| 50 | |||
| 51 | // Query string URL |
||
| 52 | $queryUrl = new \Xoops\Form\Text(_AM_XOO_SN_QUERY_URL, 'xoosocialnetwork_query_url', 5, 20, $this->xoopsObject->getVar('xoosocialnetwork_query_url')); |
||
| 53 | $queryUrl->setDatalist([ |
||
| 54 | 'u', |
||
| 55 | 'url', ]); |
||
| 56 | $this->addElement($queryUrl, true); |
||
| 57 | |||
| 58 | // Query string title |
||
| 59 | $queryString = new \Xoops\Form\Text(_AM_XOO_SN_QUERY_TITLE, 'xoosocialnetwork_query_title', 5, 20, $this->xoopsObject->getVar('xoosocialnetwork_query_title')); |
||
| 60 | $queryString->setDatalist([ |
||
| 61 | 't', |
||
| 62 | 'title', ]); |
||
| 63 | $this->addElement($queryString); |
||
| 64 | |||
| 65 | // image |
||
| 66 | $xoops = \Xoops::getInstance(); |
||
| 67 | $imageTray = new \Xoops\Form\ElementTray(_AM_XOO_SN_IMAGE, ''); |
||
| 68 | $imageArray = \XoopsLists::getImgListAsArray($xoops->path('modules/xoosocialnetwork/assets/icons/Default')); |
||
| 69 | $imageSelect = new \Xoops\Form\Select('', 'xoosocialnetwork_image', $this->xoopsObject->getVar('xoosocialnetwork_image')); |
||
| 70 | $imageSelect->addOptionArray($imageArray); |
||
| 71 | $imageSelect->setExtra("onchange='showImgSelected(\"select_image\", \"xoosocialnetwork_image\", \"" . '/' . '", "", "' . $xoops->url('modules/xoosocialnetwork/assets/icons/Default') . "\")'"); |
||
| 72 | $imageTray->addElement($imageSelect); |
||
| 73 | $imageTray->addElement(new \Xoops\Form\Label('', "<br><img src='" . $xoops->url('modules/xoosocialnetwork/assets/icons/Default/') . $this->xoopsObject->getVar('xoosocialnetwork_image') . "' name='select_image' id='select_image' alt=''>")); |
||
| 74 | $this->addElement($imageTray); |
||
| 75 | |||
| 76 | // order |
||
| 77 | $this->addElement(new \Xoops\Form\Text(_AM_XOO_SN_ORDER, 'xoosocialnetwork_order', 1, 3, $this->xoopsObject->getVar('xoosocialnetwork_order'))); |
||
| 78 | |||
| 79 | // display |
||
| 80 | $this->addElement(new \Xoops\Form\RadioYesNo(_AM_XOO_SN_DISPLAY, 'xoosocialnetwork_display', $this->xoopsObject->getVar('xoosocialnetwork_display'))); |
||
| 81 | |||
| 82 | // hidden |
||
| 83 | $this->addElement(new \Xoops\Form\Hidden('xoosocialnetwork_id', $this->xoopsObject->getVar('xoosocialnetwork_id'))); |
||
| 84 | |||
| 85 | // button |
||
| 86 | $buttonTray = new \Xoops\Form\ElementTray('', ''); |
||
| 87 | $buttonTray->addElement(new \Xoops\Form\Hidden('op', 'save')); |
||
| 88 | $buttonTray->addElement(new \Xoops\Form\Button('', 'submit', \XoopsLocale::A_SUBMIT, 'submit')); |
||
| 89 | $buttonTray->addElement(new \Xoops\Form\Button('', 'reset', \XoopsLocale::A_RESET, 'reset')); |
||
| 90 | $buttonCancelSend = new \Xoops\Form\Button('', 'cancel', \XoopsLocale::A_CANCEL, 'button'); |
||
| 91 | $buttonCancelSend->setExtra("onclick='javascript:history.go(-1);'"); |
||
| 92 | $buttonTray->addElement($buttonCancelSend); |
||
| 93 | $this->addElement($buttonTray); |
||
| 94 | } |
||
| 118 |
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