| Conditions | 11 | 
| Paths | 11 | 
| Total Lines | 64 | 
| Code Lines | 33 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 2 | ||
| Bugs | 1 | Features | 1 | 
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  | 
            ||
| 49 | public function handle(GridField $gridField, Controller $controller, $arguments = [], $data = [])  | 
            ||
| 50 |     { | 
            ||
| 51 | $fieldName = $gridField->getName();  | 
            ||
| 52 | $list = $gridField->getList();  | 
            ||
| 53 | $model = $gridField->getModelClass();  | 
            ||
| 54 | |||
| 55 | // Without this, handleSave does not work  | 
            ||
| 56 | $gridField->setSubmittedValue($data[$fieldName]);  | 
            ||
| 57 | |||
| 58 |         if (!($list instanceof DataList)) { | 
            ||
| 59 |             throw new Exception("Requires a DataList"); | 
            ||
| 60 | }  | 
            ||
| 61 | |||
| 62 |         if ($this->useHandleSave) { | 
            ||
| 63 | /** @var GridFieldEditableColumns $component */  | 
            ||
| 64 | $component = $gridField->getConfig()->getComponentByType(GridFieldEditableColumns::class);  | 
            ||
| 65 | $component->handleSave($gridField, singleton($model));  | 
            ||
| 66 | |||
| 67 | /** @var GridFieldAddNewInlineButton $component */  | 
            ||
| 68 | $component = $gridField->getConfig()->getComponentByType(GridFieldAddNewInlineButton::class);  | 
            ||
| 69 | $component->handleSave($gridField, singleton($model));  | 
            ||
| 70 |         } else { | 
            ||
| 71 |             foreach ($data[$fieldName]['GridFieldEditableColumns'] ?? [] as $id => $values) { | 
            ||
| 72 | $record = $list->byID($id);  | 
            ||
| 73 | |||
| 74 |                 if (!$record) { | 
            ||
| 75 | continue;  | 
            ||
| 76 | }  | 
            ||
| 77 | |||
| 78 |                 foreach ($values as $key => $value) { | 
            ||
| 79 | $record->$key = $value;  | 
            ||
| 80 | }  | 
            ||
| 81 | |||
| 82 | $record->write();  | 
            ||
| 83 | }  | 
            ||
| 84 | |||
| 85 |             foreach ($data[$fieldName]['GridFieldAddNewInlineButton'] ?? [] as $values) { | 
            ||
| 86 | $record = new $model;  | 
            ||
| 87 | |||
| 88 |                 foreach ($values as $key => $value) { | 
            ||
| 89 | $record->$key = $value;  | 
            ||
| 90 | }  | 
            ||
| 91 | |||
| 92 | $record->write();  | 
            ||
| 93 | }  | 
            ||
| 94 | }  | 
            ||
| 95 | |||
| 96 | $response = $controller->getResponse();  | 
            ||
| 97 | |||
| 98 |         if (Director::is_ajax()) { | 
            ||
| 99 |             if (!$this->completeMessage) { | 
            ||
| 100 |                 $this->completeMessage = _t('GridFieldSaveAllButton.DONE', 'All saved'); | 
            ||
| 101 | }  | 
            ||
| 102 | |||
| 103 |             if ($this->shouldReload) { | 
            ||
| 104 | ActionsGridFieldItemRequest::addXReload($controller);  | 
            ||
| 105 | }  | 
            ||
| 106 | |||
| 107 |             $response->addHeader('X-Status', rawurlencode($this->completeMessage)); | 
            ||
| 108 | |||
| 109 | return null;  | 
            ||
| 110 | }  | 
            ||
| 111 | |||
| 112 | return $controller->redirectBack();  | 
            ||
| 113 | }  | 
            ||
| 172 | 
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