| Conditions | 28 | 
| Paths | > 20000 | 
| Total Lines | 142 | 
| Code Lines | 93 | 
| 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 | ||
| 264 | protected function addSections($view = '') | ||
| 265 |     { | ||
| 266 | $App = $this->App(); | ||
| 267 | $W = bab_Widgets(); | ||
| 268 | |||
| 269 | $objectName = $this->getViewObjectName(); | ||
| 270 | |||
| 271 | $customContainerSet = $App->CustomContainerSet(); | ||
| 272 | $customContainers = $customContainerSet->select( | ||
| 273 | $customContainerSet->object->is($objectName)->_AND_($customContainerSet->view->is($view)) | ||
| 274 | ); | ||
| 275 | $customContainers->orderAsc($customContainerSet->rank); | ||
| 276 | |||
| 277 | |||
| 278 | $customSectionSet = $App->CustomSectionSet(); | ||
| 279 | |||
| 280 |         foreach ($customContainers as $customContainer) { | ||
| 281 | |||
| 282 |             if (isset($this->record) && !$customContainer->isVisibleForRecord($this->record)) { | ||
| 283 | continue; | ||
| 284 | } | ||
| 285 | |||
| 286 | $container = $W->Items() | ||
| 287 | ->addClass($customContainer->classname) | ||
| 288 |             ->setSizePolicy("app-container {$customContainer->sizePolicy}"); | ||
| 289 | |||
| 290 | $this->addItem($container); | ||
| 291 | |||
| 292 | $customSections = $customSectionSet->select( | ||
| 293 | $customSectionSet->container->is($customContainer->id) | ||
| 294 | ); | ||
| 295 | $customSections->orderAsc($customSectionSet->rank); | ||
| 296 | |||
| 297 | $currentColumn = 0; | ||
| 298 | $nbCol = 0; | ||
| 299 |             $row = $W->Items()->setSizePolicy('row'); | ||
| 300 |             $row->addClass('row'); | ||
| 301 | |||
| 302 |             foreach ($customSections as $customSection) { | ||
| 303 | |||
| 304 |                 if (isset($this->record) && !$customSection->isVisibleForRecord($this->record)) { | ||
| 305 | continue; | ||
| 306 | } | ||
| 307 | |||
| 308 |                 list(, , $nbCol) = explode('-', $customSection->sizePolicy); | ||
| 309 | |||
| 310 |                 if ($currentColumn + $nbCol > 12) { | ||
| 311 | $container->addItem($row); | ||
| 312 |                     $row = $W->Items()->setSizePolicy('row'); | ||
| 313 |                     $row->addClass('row'); | ||
| 314 | $currentColumn = 0; | ||
| 315 | } | ||
| 316 | $currentColumn += $nbCol; | ||
| 317 | |||
| 318 |                 if (strpos($customSection->classname, 'horizontal') !== false) { | ||
| 319 | $box = $W->FlowItems() | ||
| 320 |                     ->setVerticalAlign('top') | ||
| 321 | ->setSpacing(1, 'em'); | ||
| 322 |                 } else { | ||
| 323 | $box = null; | ||
| 324 | } | ||
| 325 | |||
| 326 | $section = $this->getSection($customSection->id); | ||
| 327 |                 if (!isset($section)) { | ||
| 328 | $section = $this->addSection($customSection->id, $customSection->name, $box); | ||
| 329 | $section->addClass($customSection->classname); | ||
| 330 | $section->setSizePolicy($customSection->sizePolicy); | ||
| 331 | |||
| 332 |                     $menu = $section->addContextMenu('inline'); | ||
| 333 | $menu->addClass(\Func_Icons::ICON_LEFT_16); | ||
| 334 | |||
| 335 |                     if ($customSection->editable && $this->recordIsUpdateable) { | ||
| 336 | $menu->addItem( | ||
| 337 | $W->Link( | ||
| 338 | '', | ||
| 339 | $this->record->getController()->editSection($this->record->id, $customSection->id) | ||
| 340 |                                 )->addClass('widget-actionbutton', 'section-button', 'icon', \Func_Icons::ACTIONS_DOCUMENT_EDIT) | ||
| 341 |                             ->setOpenMode(WidgetLink::OPEN_DIALOG)->setDialogClass('customSectionEditorDialog '.$customSection->classname) | ||
| 342 | ); | ||
| 343 | } | ||
| 344 | |||
| 345 | $section->setFoldable($customSection->foldable, $customSection->folded); | ||
| 346 | $row->addItem($section); | ||
| 347 | } | ||
| 348 | |||
| 349 | |||
| 350 | |||
| 351 | $displayFields = $customSection->getFields(); | ||
| 352 | |||
| 353 |                 foreach ($displayFields as $displayFieldId => $displayField) { | ||
| 354 | $isGroupField = strpos($displayFieldId, '_fieldsGroup') !== false; | ||
| 355 | $item = null; | ||
| 356 | $displayFieldName = $displayField['fieldname']; | ||
| 357 | $parameters = $displayField['parameters']; | ||
| 358 | $classname = isset($parameters['classname']) ? $parameters['classname'] : ''; | ||
| 359 | $label = isset($parameters['label']) && !empty($parameters['label']) ? $parameters['label'] : null; | ||
| 360 | $sizePolicy = 'customsection-field-box '; | ||
| 361 | $sizePolicy .= isset($parameters['sizePolicy']) ? $parameters['sizePolicy'] : ''; | ||
| 362 | $sizePolicy .= isset($parameters['transparentBackground']) && $parameters['transparentBackground'] ? 'customsection-field-box-transparentBackground' : ''; | ||
| 363 | |||
| 364 | $displayFieldMethod = '_' . $displayFieldName; | ||
| 365 |                     if (!$isGroupField && method_exists($this, $displayFieldMethod)) { | ||
| 366 | $item = $this->$displayFieldMethod($customSection, $label); | ||
| 367 | } | ||
| 368 |                     else { | ||
| 369 |                         if($isGroupField){ | ||
| 370 |                             list(, $groupId) = explode('_fieldsGroup', $displayFieldId); | ||
| 371 |                             if (method_exists($this, '__fieldsGroup')) { | ||
| 372 | $item = $this->__fieldsGroup($customSection, $groupId, $label); | ||
| 373 | } | ||
| 374 | $sizePolicy .= ' customsection-fieldsgroup-box'; | ||
| 375 | } | ||
| 376 |                         else{ | ||
| 377 |                             try { | ||
| 378 | $field = $this->recordSet->getField($displayFieldName); | ||
| 379 | $value = $this->fieldOutput($field, $this->record, $displayFieldName); | ||
| 380 |                                 if (!isset($label)) { | ||
| 381 | $label = $App->translate($field->getDescription()); | ||
| 382 | } | ||
| 383 | |||
| 384 | $outputWidget = $field->outputWidget($this->record->$displayFieldName); | ||
| 385 | |||
| 386 | $item = $this->labelledWidget( | ||
| 387 | $label, | ||
| 388 | $outputWidget, | ||
| 389 | $customSection | ||
| 390 | ); | ||
| 391 |                             } catch (ORMException $e) { | ||
| 392 | $item = null; | ||
| 393 | } | ||
| 394 | } | ||
| 395 | } | ||
| 396 |                     if (isset($item) && $item instanceof WidgetDisplayableInterface) { | ||
| 397 | $item->setSizePolicy($sizePolicy); | ||
| 398 | $item->addClass($classname); | ||
| 399 | $section->addItem($item); | ||
| 400 | } | ||
| 401 | } | ||
| 402 | } | ||
| 403 | |||
| 404 |             if ($currentColumn + $nbCol> 0) { | ||
| 405 | $container->addItem($row); | ||
| 406 | } | ||
| 479 | } | 
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