Conditions | 5 |
Paths | 4 |
Total Lines | 92 |
Code Lines | 82 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | 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 |
||
146 | public function renderAdminListing($sort = 'id') |
||
147 | { |
||
148 | if (!class_exists('Xoopsfaq\Utility')) { |
||
149 | xoops_load('utility', basename(dirname(__DIR__))); |
||
150 | } |
||
151 | |||
152 | /** @var CategoryHandler $categoryHandler */ |
||
153 | $objects = $this->getObj($sort); |
||
154 | $helper = \XoopsModules\Xoopsfaq\Helper::getHelper(basename(dirname(__DIR__))); |
||
155 | $categoryHandler = $helper->getHandler('Category'); |
||
156 | $catFields = ['category_id', 'category_title']; |
||
157 | $catArray = $categoryHandler->getAll(null, $catFields, false); |
||
158 | |||
159 | $buttons = ['edit', 'delete']; |
||
160 | |||
161 | $ret = '<table class="outer width100 bnone pad3 marg5">' |
||
162 | . ' <thead>' |
||
163 | . ' <tr class="center">' |
||
164 | . ' <th class="width5">' |
||
165 | . _AM_XOOPSFAQ_CONTENTS_ID |
||
166 | . '</th>' |
||
167 | . ' <th class="width5">' |
||
168 | . _AM_XOOPSFAQ_CONTENTS_ACTIVE |
||
169 | . '</th>' |
||
170 | . ' <th class="width5">' |
||
171 | . _AM_XOOPSFAQ_CONTENTS_WEIGHT |
||
172 | . '</th>' |
||
173 | . ' <th class="left">' |
||
174 | . _AM_XOOPSFAQ_CONTENTS_TITLE |
||
175 | . '</th>' |
||
176 | . ' <th class="left">' |
||
177 | . _AM_XOOPSFAQ_CATEGORY_TITLE |
||
178 | . '</th>' |
||
179 | . ' <th>' |
||
180 | . _AM_XOOPSFAQ_CONTENTS_PUBLISH |
||
181 | . '</th>' |
||
182 | . ' <th class="width20">' |
||
183 | . _AM_XOOPSFAQ_ACTIONS |
||
184 | . '</th>' |
||
185 | . ' </tr>' |
||
186 | . ' </thead>' |
||
187 | . ' <tbody>'; |
||
188 | if ($objects['count'] > 0) { |
||
189 | $tdClass = 0; |
||
190 | /** @var \Contents $object */ |
||
191 | foreach ($objects['list'] as $object) { |
||
192 | $thisCatId = $object->getVar('contents_cid'); |
||
193 | $thisCatTitle = $catArray[$thisCatId]['category_title']; |
||
194 | $thisContentTitle = '<a href="' . $helper->url('index.php?cat_id=' . $thisCatId . '#q' . $object->getVar('contents_id')) . '" title="' . _AM_XOOPSFAQ_CONTENTS_VIEW . '">' . $object->getVar('contents_title') . '</a>'; |
||
195 | ++$tdClass; |
||
196 | $dispClass = ($tdClass % 1) ? 'even' : 'odd'; |
||
197 | $ret .= ' <tr class="center middle">' |
||
198 | . ' <td class="' |
||
199 | . $dispClass |
||
200 | . '">' |
||
201 | . $object->getVar('contents_id') |
||
202 | . '</td>' |
||
203 | . ' <td class="' |
||
204 | . $dispClass |
||
205 | . '">' |
||
206 | . $object->getActiveIcon() |
||
207 | . '</td>' |
||
208 | . ' <td class="' |
||
209 | . $dispClass |
||
210 | . '">' |
||
211 | . $object->getVar('contents_weight') |
||
212 | . '</td>' |
||
213 | . ' <td class="' |
||
214 | . $dispClass |
||
215 | . ' left">' |
||
216 | . $thisContentTitle |
||
217 | . '</td>' |
||
218 | . ' <td class="' |
||
219 | . $dispClass |
||
220 | . ' left">' |
||
221 | . $thisCatTitle |
||
222 | . '</td>' |
||
223 | . ' <td class="' |
||
224 | . $dispClass |
||
225 | . '">' |
||
226 | . $object->getPublished(_SHORTDATESTRING) |
||
227 | . '</td>' |
||
228 | . ' <td class="' |
||
229 | . $dispClass |
||
230 | . '">'; |
||
231 | $ret .= Xoopsfaq\Utility::renderIconLinks($buttons, 'contents_id', $object->getVar('contents_id')) . '</td>' . ' </tr>'; |
||
232 | } |
||
233 | } else { |
||
234 | $ret .= ' <tr class="center"><td colspan="7" class="even">' . _AM_XOOPSFAQ_NOLISTING . '</td></tr>'; |
||
235 | } |
||
236 | $ret .= ' </tbody>' . '</table>'; |
||
237 | return $ret; |
||
238 | } |
||
261 |
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