| Conditions | 3 |
| Paths | 1 |
| Total Lines | 62 |
| 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 |
||
| 97 | public function getCMSFields() |
||
| 98 | { |
||
| 99 | $this->beforeUpdateCMSFields(function (FieldList $fields) { |
||
| 100 | // Related Pages |
||
| 101 | $components = GridFieldConfig_RelationEditor::create(); |
||
| 102 | $components->removeComponentsByType(GridFieldAddNewButton::class); |
||
| 103 | $components->removeComponentsByType(GridFieldEditButton::class); |
||
| 104 | $components->removeComponentsByType(GridFieldFilterHeader::class); |
||
| 105 | $components->addComponent(new GridFieldOrderableRows('SortOrder')); |
||
| 106 | |||
| 107 | /** @var GridFieldDataColumns $dataColumns */ |
||
| 108 | $dataColumns = $components->getComponentByType(GridFieldDataColumns::class); |
||
| 109 | $dataColumns->setDisplayFields([ |
||
| 110 | 'Title' => _t(__CLASS__ . '.ColumnTitle', 'Title'), |
||
| 111 | 'ClassName' => _t(__CLASS__ . '.ColumnPageType', 'Page Type') |
||
| 112 | ]); |
||
| 113 | |||
| 114 | $fields->findOrMakeTab( |
||
| 115 | 'Root.RelatedPages', |
||
| 116 | _t(__CLASS__ . '.RelatedPages', 'Related pages') |
||
| 117 | ); |
||
| 118 | $fields->addFieldToTab( |
||
| 119 | 'Root.RelatedPages', |
||
| 120 | GridField::create( |
||
| 121 | 'RelatedPages', |
||
| 122 | _t(__CLASS__ . '.RelatedPages', 'Related pages'), |
||
| 123 | $this->RelatedPages(), |
||
| 124 | $components |
||
| 125 | ) |
||
| 126 | ); |
||
| 127 | |||
| 128 | // Taxonomies - Unless they have their own 'Tags' field (such as in Blog, etc) |
||
| 129 | $hasMany = $this->hasMany(); |
||
| 130 | $manyMany = $this->manyMany(); |
||
| 131 | if (!isset($hasMany['Tags']) && !isset($manyMany['Tags'])) { |
||
| 132 | $components = GridFieldConfig_RelationEditor::create(); |
||
| 133 | $components->removeComponentsByType(GridFieldAddNewButton::class); |
||
| 134 | $components->removeComponentsByType(GridFieldEditButton::class); |
||
| 135 | |||
| 136 | /** @var GridFieldAddExistingAutocompleter $autoCompleter */ |
||
| 137 | $autoCompleter = $components->getComponentByType(GridFieldAddExistingAutocompleter::class); |
||
| 138 | $autoCompleter->setResultsFormat('$Name ($TaxonomyName)'); |
||
| 139 | |||
| 140 | /** @var GridFieldDataColumns $dataColumns */ |
||
| 141 | $dataColumns = $components->getComponentByType(GridFieldDataColumns::class); |
||
| 142 | $dataColumns->setDisplayFields([ |
||
| 143 | 'Name' => _t(__CLASS__ . '.Term', 'Term'), |
||
| 144 | 'TaxonomyName' => _t(__CLASS__ . '.Taxonomy', 'Taxonomy') |
||
| 145 | ]); |
||
| 146 | |||
| 147 | $fields->findOrMakeTab('Root.Tags', _t(__CLASS__ . '.TagsTabTitle', 'Tags')); |
||
| 148 | $fields->addFieldToTab( |
||
| 149 | 'Root.Tags', |
||
| 150 | TreeMultiselectField::create( |
||
| 151 | 'Terms', |
||
| 152 | _t(__CLASS__ . '.Terms', 'Terms'), |
||
| 153 | TaxonomyTerm::class |
||
| 154 | )->setDescription(_t(__CLASS__ . '.TermsDescription', 'Click to search for additional terms')) |
||
| 155 | ); |
||
| 156 | } |
||
| 157 | }); |
||
| 158 | return parent::getCMSFields(); |
||
| 159 | } |
||
| 178 |
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