| Conditions | 1 |
| Paths | 1 |
| Total Lines | 51 |
| Code Lines | 37 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 4 | ||
| 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 |
||
| 46 | public function updateCMSFields(FieldList $fields) |
||
| 47 | { |
||
| 48 | $fields->removeByName("ContactPhone"); |
||
| 49 | $fields->removeByName("ContactEmail"); |
||
| 50 | $fields->removeByName("ContactAddress"); |
||
| 51 | $fields->removeByName("SiteLocale"); |
||
| 52 | $fields->removeByName("ShowPriceAndTax"); |
||
| 53 | $fields->removeByName("ShowPriceTaxString"); |
||
| 54 | |||
| 55 | $fields->addFieldsToTab( |
||
| 56 | "Root.Main", |
||
| 57 | [ |
||
| 58 | DropdownField::create( |
||
| 59 | "SiteLocale", |
||
| 60 | $this->owner->fieldLabel("SiteLocale"), |
||
| 61 | i18n::getSources()->getKnownLocales() |
||
| 62 | ), |
||
| 63 | TextField::create( |
||
| 64 | "ContactPhone", |
||
| 65 | $this->owner->fieldLabel("ContactPhone") |
||
| 66 | ), |
||
| 67 | TextField::create( |
||
| 68 | "ContactEmail", |
||
| 69 | $this->owner->fieldLabel("ContactEmail") |
||
| 70 | ), |
||
| 71 | TextareaField::create( |
||
| 72 | "ContactAddress", |
||
| 73 | $this->owner->fieldLabel("ContactAddress") |
||
| 74 | ) |
||
| 75 | ] |
||
| 76 | ); |
||
| 77 | |||
| 78 | $fields->addFieldToTab( |
||
| 79 | "Root.Shop", |
||
| 80 | ToggleCompositeField::create( |
||
| 81 | 'MiscSettings', |
||
| 82 | _t("Settings.MiscSettings", "Misc Settings"), |
||
| 83 | [ |
||
| 84 | CheckboxField::create("ShowPriceAndTax") |
||
| 85 | ->setDescription(_t( |
||
| 86 | "SilverCommerce\Settings.ShowPriceAndTaxDescription", |
||
| 87 | "Show product prices including tax" |
||
| 88 | )), |
||
| 89 | CheckboxField::create("ShowPriceTaxString") |
||
| 90 | ->setDescription(_t( |
||
| 91 | "SilverCommerce\Settings.ShowProductTaxStringDescription", |
||
| 92 | "Show 'inc/exc TAX' after price" |
||
| 93 | )), |
||
| 94 | UploadField::create( |
||
| 95 | "CardLogos", |
||
| 96 | $this->owner->fieldLabel("CardLogos") |
||
| 97 | ) |
||
| 109 | } |
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