Conditions | 13 |
Paths | 1536 |
Total Lines | 53 |
Code Lines | 31 |
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 |
||
47 | public function create($type) |
||
48 | { |
||
49 | switch ($type) { |
||
50 | case 'datatables': |
||
51 | $renderer = new DataTablesRenderer($this->twigEngine, $this->router); |
||
52 | break; |
||
53 | case 'jq_grid': |
||
54 | $renderer = new JQGridRenderer($this->twigEngine, $this->router); |
||
55 | break; |
||
56 | case 'table': |
||
57 | $renderer = new TableGridRenderer($this->twigEngine, $this->router); |
||
58 | break; |
||
59 | default: |
||
60 | throw new \Exception("No renderer for type '$type''"); |
||
61 | } |
||
62 | |||
63 | if (method_exists($renderer, 'setThemeCss')) { |
||
64 | $renderer->setThemeCss($this->themeCss); |
||
65 | } |
||
66 | |||
67 | if (method_exists($renderer, 'setThemeJs')) { |
||
68 | $renderer->setThemeJs($this->themeJs); |
||
69 | } |
||
70 | |||
71 | if (method_exists($renderer, 'setJQuery')) { |
||
72 | $renderer->setJQuery($this->jQuery); |
||
73 | } |
||
74 | |||
75 | if (method_exists($renderer, 'setPurl')) { |
||
76 | $renderer->setPurl($this->purl); |
||
77 | } |
||
78 | |||
79 | if (method_exists($renderer, 'setPageDivStyle')) { |
||
80 | $renderer->setPageDivStyle($this->pageDivStyle); |
||
81 | } |
||
82 | |||
83 | if (method_exists($renderer, 'setJqGridCss')) { |
||
84 | $renderer->setJqGridCss($this->jqGridCss); |
||
85 | } |
||
86 | |||
87 | if (method_exists($renderer, 'setJqGridJs')) { |
||
88 | $renderer->setJqGridJs($this->jqGridJs); |
||
89 | } |
||
90 | |||
91 | if (method_exists($renderer, 'setDataTablesCss')) { |
||
92 | $renderer->setDataTablesCss($this->dataTablesCss); |
||
93 | } |
||
94 | |||
95 | if (method_exists($renderer, 'setDataTablesJs')) { |
||
96 | $renderer->setDataTablesJs($this->dataTablesJs); |
||
97 | } |
||
98 | |||
99 | return $renderer; |
||
100 | } |
||
102 |
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