| Conditions | 12 | 
| Paths | 258 | 
| Total Lines | 96 | 
| Code Lines | 54 | 
| 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  | 
            ||
| 191 | public function getReportField($itemType = 'Pages')  | 
            ||
| 192 |     { | 
            ||
| 193 | $params = isset($_REQUEST['filters']) ? $_REQUEST['filters'] : array();  | 
            ||
| 194 | $items = $this->sourceRecords($params, null, null);  | 
            ||
| 195 | |||
| 196 |         $gridField = new GridFieldBasicContentReport('Report-'.$itemType, false, $items[$itemType]); | 
            ||
| 197 | |||
| 198 | $gridFieldConfig = GridFieldConfig::create()->addComponents(  | 
            ||
| 199 | new GridFieldToolbarHeader(),  | 
            ||
| 200 | new GridFieldSortableHeader(),  | 
            ||
| 201 | new GridFieldDataColumns(),  | 
            ||
| 202 | new GridFieldPaginator(),  | 
            ||
| 203 |             new GridFieldButtonRow('after'), | 
            ||
| 204 |             $printButton = new GridFieldPrintButton('buttons-after-left'), | 
            ||
| 205 |             $exportButton = new GridFieldExportButton('buttons-after-left') | 
            ||
| 206 | );  | 
            ||
| 207 | |||
| 208 | $gridField->setConfig($gridFieldConfig);  | 
            ||
| 209 | |||
| 210 | /* @var $columns GridFieldDataColumns */  | 
            ||
| 211 | $columns = $gridField->getConfig()->getComponentByType(GridFieldDataColumns::class);  | 
            ||
| 212 | |||
| 213 | $exportFields = [];  | 
            ||
| 214 | $displayFields = [];  | 
            ||
| 215 | $fieldCasting = [];  | 
            ||
| 216 | $fieldFormatting = [];  | 
            ||
| 217 | $dataFields = [];  | 
            ||
| 218 | |||
| 219 | // Parse the column information  | 
            ||
| 220 |         foreach ($this->columns($itemType) as $source => $info) { | 
            ||
| 221 |             if (is_string($info)) { | 
            ||
| 222 | $info = ['title' => $info];  | 
            ||
| 223 | }  | 
            ||
| 224 | |||
| 225 |             if (isset($info['formatting'])) { | 
            ||
| 226 | $fieldFormatting[$source] = $info['formatting'];  | 
            ||
| 227 | }  | 
            ||
| 228 |             if (isset($info['casting'])) { | 
            ||
| 229 | $fieldCasting[$source] = $info['casting'];  | 
            ||
| 230 | }  | 
            ||
| 231 | |||
| 232 |             if (isset($info['link']) && $info['link']) { | 
            ||
| 233 |                 $fieldFormatting[$source] = function ($value, &$item) { | 
            ||
| 234 |                     if ($item instanceof Page) { | 
            ||
| 235 | return sprintf(  | 
            ||
| 236 | "<a href='%s'>%s</a>",  | 
            ||
| 237 |                             Controller::join_links(singleton(CMSPageEditController::class)->Link('show'), $item->ID), | 
            ||
| 238 | $value  | 
            ||
| 239 | );  | 
            ||
| 240 | }  | 
            ||
| 241 | |||
| 242 | return sprintf(  | 
            ||
| 243 | "<a href='%s'>%s</a>",  | 
            ||
| 244 | Controller::join_links(  | 
            ||
| 245 |                             singleton(AssetAdmin::class)->Link('EditForm'), | 
            ||
| 246 | 'field/File/item',  | 
            ||
| 247 | $item->ID,  | 
            ||
| 248 | 'edit'  | 
            ||
| 249 | ),  | 
            ||
| 250 | $value  | 
            ||
| 251 | );  | 
            ||
| 252 | };  | 
            ||
| 253 | }  | 
            ||
| 254 | |||
| 255 | // Set custom datasource  | 
            ||
| 256 |             if (isset($info['datasource'])) { | 
            ||
| 257 | $dataFields[$source] = $info['datasource'];  | 
            ||
| 258 | }  | 
            ||
| 259 | |||
| 260 | // Set field name for export  | 
            ||
| 261 | $fieldTitle = isset($info['title']) ? $info['title'] : $source;  | 
            ||
| 262 | |||
| 263 | // If not print-only, then add to display list  | 
            ||
| 264 |             if (empty($info['printonly'])) { | 
            ||
| 265 | $displayFields[$source] = $fieldTitle;  | 
            ||
| 266 | }  | 
            ||
| 267 | |||
| 268 | // Assume that all displayed fields are printed also  | 
            ||
| 269 | $exportFields[$source] = $fieldTitle;  | 
            ||
| 270 | }  | 
            ||
| 271 | |||
| 272 | // Set custom evaluated columns  | 
            ||
| 273 | $gridField->addDataFields($dataFields);  | 
            ||
| 274 | |||
| 275 | // Set visible fields  | 
            ||
| 276 | $columns->setDisplayFields($displayFields);  | 
            ||
| 277 | $columns->setFieldCasting($fieldCasting);  | 
            ||
| 278 | $columns->setFieldFormatting($fieldFormatting);  | 
            ||
| 279 | |||
| 280 | // Get print columns, and merge with print-only columns  | 
            ||
| 281 | $printExportColumns = $this->getPrintExportColumns($gridField, $itemType, $exportFields);  | 
            ||
| 282 | |||
| 283 | $printButton->setPrintColumns($printExportColumns);  | 
            ||
| 284 | $exportButton->setExportColumns($printExportColumns);  | 
            ||
| 285 | |||
| 286 | return $gridField;  | 
            ||
| 287 | }  | 
            ||
| 309 | 
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