Conditions | 20 |
Paths | > 20000 |
Total Lines | 77 |
Code Lines | 44 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 1 | Features | 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 |
||
76 | public function create($type) |
||
77 | { |
||
78 | $twig = $this->getTwigEnvironment(); |
||
79 | if (!$twig) { |
||
80 | throw new \Exception('Twig Engine not found. Please see https://github.com/mmucklo/DtcGridBundle/README.md for instructions.'); |
||
81 | } |
||
82 | switch ($type) { |
||
83 | case 'datatables': |
||
84 | $renderer = new DataTablesRenderer($this->twig, $this->router, $this->translator, $this->dataTablesOptions); |
||
85 | break; |
||
86 | case 'jq_grid': |
||
87 | $renderer = new JQGridRenderer($this->twig, $this->router, $this->translator, $this->jqGridOptions); |
||
88 | break; |
||
89 | case 'table': |
||
90 | $renderer = new TableGridRenderer($this->twig, $this->router, $this->translator, $this->tableOptions); |
||
91 | break; |
||
92 | default: |
||
93 | throw new \Exception("No renderer for type '$type''"); |
||
94 | } |
||
95 | |||
96 | if (method_exists($renderer, 'setThemeCss')) { |
||
97 | $renderer->setThemeCss($this->themeCss); |
||
98 | } |
||
99 | |||
100 | if (method_exists($renderer, 'setThemeJs')) { |
||
101 | $renderer->setThemeJs($this->themeJs); |
||
102 | } |
||
103 | |||
104 | if (method_exists($renderer, 'setJQuery')) { |
||
105 | $renderer->setJQuery($this->jQuery); |
||
106 | } |
||
107 | |||
108 | if (method_exists($renderer, 'setPurl')) { |
||
109 | $renderer->setPurl($this->purl); |
||
110 | } |
||
111 | |||
112 | if (method_exists($renderer, 'setPageDivStyle')) { |
||
113 | $renderer->setPageDivStyle($this->pageDivStyle); |
||
114 | } |
||
115 | |||
116 | if (method_exists($renderer, 'setJqGridCss')) { |
||
117 | $renderer->setJqGridCss($this->jqGridCss); |
||
118 | } |
||
119 | |||
120 | if (method_exists($renderer, 'setJqGridJs')) { |
||
121 | $renderer->setJqGridJs($this->jqGridJs); |
||
122 | } |
||
123 | |||
124 | if (method_exists($renderer, 'setJqGridLocalCss')) { |
||
125 | $renderer->setJqGridLocalCss($this->jqGridLocalCss); |
||
126 | } |
||
127 | |||
128 | if (method_exists($renderer, 'setJqGridLocalJs')) { |
||
129 | $renderer->setJqGridLocalJs($this->jqGridLocalJs); |
||
130 | } |
||
131 | |||
132 | if (method_exists($renderer, 'setDataTablesCss')) { |
||
133 | $renderer->setDataTablesCss($this->dataTablesCss); |
||
134 | } |
||
135 | |||
136 | if (method_exists($renderer, 'setDataTablesJs')) { |
||
137 | $renderer->setDataTablesJs($this->dataTablesJs); |
||
138 | } |
||
139 | |||
140 | if (method_exists($renderer, 'setDataTablesLocalCss')) { |
||
141 | $renderer->setDataTablesLocalCss($this->dataTablesLocalCss); |
||
142 | } |
||
143 | |||
144 | if (method_exists($renderer, 'setDataTablesLocalJs')) { |
||
145 | $renderer->setDataTablesLocalJs($this->dataTablesLocalJs); |
||
146 | } |
||
147 | |||
148 | if (method_exists($renderer, 'setDatatablesClass') && $this->dataTablesClass) { |
||
149 | $renderer->setDatatablesClass($this->dataTablesClass); |
||
150 | } |
||
151 | |||
152 | return $renderer; |
||
153 | } |
||
155 |
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