| Conditions | 18 |
| Paths | 768 |
| Total Lines | 50 |
| Code Lines | 41 |
| Lines | 3 |
| Ratio | 6 % |
| 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 |
||
| 13 | public function formPopUpAction() { |
||
| 14 | if (strpos($_GET['item'], ':')) { |
||
| 15 | $raw = explode(':', $_GET['item']); |
||
| 16 | $modelName = $raw[0]; |
||
| 17 | $id = $raw[1]; |
||
| 18 | $model = $modelName::get($id, $modelName::index(), !empty($_GET['params']['dataManagerParams']) ? $_GET['params']['dataManagerParams'] : []); |
||
| 19 | } else { |
||
| 20 | $modelName = $_GET['item']; |
||
| 21 | $model = new $modelName(); |
||
| 22 | } |
||
| 23 | $params = []; |
||
| 24 | if (!empty($_GET['params'])) { |
||
| 25 | $params = $_GET['params']; |
||
| 26 | if (!empty($params['preset'])) { |
||
| 27 | $model->setParams($params['preset']); |
||
| 28 | } |
||
| 29 | } |
||
| 30 | if (!empty($_GET['params']['dataManagerParams']['appType'])) { |
||
| 31 | $params['appType'] = $_GET['params']['dataManagerParams']['appType']; |
||
| 32 | } |
||
| 33 | |||
| 34 | $formName = !empty($_GET['formName']) ? $_GET['formName'] : (!empty($_GET['params']['formName']) ? $_GET['params']['formName'] : 'manager'); |
||
| 35 | $form = new Ui\ActiveForm($model, $formName); |
||
| 36 | if (!empty($_GET['_']) || !empty($_POST['_'])) { |
||
| 37 | $return = new Server\Result(); |
||
| 38 | ob_start(); |
||
| 39 | $form->checkRequest($params, true); |
||
| 40 | $_GET['item'] = get_class($form->model) . ($model->pk() ? ':' . $model->pk() : ''); |
||
| 41 | $get = $_GET; |
||
| 42 | if (isset($get['notSave'])) { |
||
| 43 | unset($get['notSave']); |
||
| 44 | } |
||
| 45 | $this->view->widget('msgList'); |
||
| 46 | $form->action = (App::$cur->system ? '/' . App::$cur->name : '') . '/ui/formPopUp/?' . http_build_query($get); |
||
| 47 | $form->draw($params, true); |
||
| 48 | $return->content = ob_get_contents(); |
||
| 49 | ob_end_clean(); |
||
| 50 | $return->send(); |
||
| 51 | } else { |
||
| 52 | $form->checkRequest($params); |
||
| 53 | $_GET['item'] = get_class($form->model) . ($model->pk() ? ':' . $model->pk() : ''); |
||
| 54 | $get = $_GET; |
||
| 55 | if (isset($get['notSave'])) { |
||
| 56 | unset($get['notSave']); |
||
| 57 | } |
||
| 58 | $form->action = (App::$cur->system ? '/' . App::$cur->name : '') . '/ui/formPopUp/?' . http_build_query($get); |
||
| 59 | $this->view->setTitle(($model && $model->pk() ? 'Изменить ' : 'Создать ') . $form->header); |
||
| 60 | $this->view->page(['content' => 'form', 'data' => compact('form', 'params')]); |
||
| 61 | } |
||
| 62 | } |
||
| 63 | |||
| 83 |
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