| Conditions | 11 |
| Paths | 13 |
| Total Lines | 37 |
| Code Lines | 23 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 7 | ||
| 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 |
||
| 35 | public function updateEditForm($form) |
||
| 36 | { |
||
| 37 | $owner = $this->getOwner(); |
||
| 38 | if ($this->IsIncludedInExtension()) { |
||
| 39 | $obj = Injector::inst()->get($owner->modelClass); |
||
| 40 | if ($obj) { |
||
| 41 | $sortFields = $owner->config()->get('sort_fields_from_ssu_extension'); |
||
| 42 | $gridField = $form->Fields()->dataFieldByName($this->sanitiseClassNameHelper($owner->modelClass)); |
||
| 43 | if ($gridField instanceof GridField) { |
||
| 44 | $config = $gridField->getConfig(); |
||
| 45 | $dbFields = $obj->config()->get('db'); |
||
| 46 | foreach ($sortFields as $sortField) { |
||
| 47 | if (isset($dbFields[$sortField])) { |
||
| 48 | // This is just a precaution to ensure we got a GridField from dataFieldByName() which you should have |
||
| 49 | if (! $config->getComponentByType(GridFieldSortableRows::class)) { |
||
| 50 | $obj = $owner->modelClass::singleton(); |
||
| 51 | if ($obj->hasExtension(Versioned::class)) { |
||
| 52 | $sorter = (new GridFieldSortableRows($sortField)) |
||
| 53 | ->setUpdateVersionedStage(Versioned::LIVE); |
||
| 54 | } else { |
||
| 55 | $sorter = new GridFieldSortableRows($sortField); |
||
| 56 | } |
||
| 57 | $config->addComponent($sorter); |
||
| 58 | } |
||
| 59 | break; |
||
| 60 | } |
||
| 61 | } |
||
| 62 | |||
| 63 | if ($obj->hasExtension(Versioned::class) && $obj->hasStages() && class_exists(GridFieldSiteTreeState::class)) { |
||
| 64 | $config->addComponent(new GridFieldSiteTreeState()); |
||
| 65 | } |
||
| 66 | } |
||
| 67 | } |
||
| 68 | } |
||
| 69 | |||
| 70 | |||
| 71 | return $form; |
||
| 72 | } |
||
| 119 |
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