| Conditions | 1 |
| Paths | 1 |
| Total Lines | 51 |
| Code Lines | 38 |
| 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 |
||
| 28 | public function updateCMSFields(FieldList $fieldList): void |
||
| 29 | { |
||
| 30 | $fieldList->addFieldsToTab( |
||
| 31 | 'Root.Shop.ShopTabs.' . _t('SilverShop\Extension\ShopConfigExtension.BankAccountTitle', 'Bank Account'), |
||
| 32 | [ |
||
| 33 | Textfield::create( |
||
| 34 | "BankAccountPaymentMethodMessage", |
||
| 35 | _t( |
||
| 36 | "SilverShop\\Extension\\ShopConfigExtension.BankAccountPaymentMethodMessage", |
||
| 37 | "Payment Method message on Checkout page" |
||
| 38 | ) |
||
| 39 | )->setDescription( |
||
| 40 | _t( |
||
| 41 | "SilverShop\\Extension\\ShopConfigExtension.BankAccountPaymentMethodMessageDescription", |
||
| 42 | "Message to appear in the Payment Method section of Checkout Page" |
||
| 43 | ) |
||
| 44 | ), |
||
| 45 | Textfield::create( |
||
| 46 | "BankAccountNumber", |
||
| 47 | _t( |
||
| 48 | "SilverShop\\Extension\\ShopConfigExtension.BankAccountNumber", |
||
| 49 | "Bank Account Number" |
||
| 50 | ) |
||
| 51 | )->setDescription( |
||
| 52 | _t( |
||
| 53 | "SilverShop\\Extension\\ShopConfigExtension.BankAccountNumberDescription", |
||
| 54 | "e.g XX-XXXX-XXXXXXX-XX" |
||
| 55 | ) |
||
| 56 | ), |
||
| 57 | TextareaField::create( |
||
| 58 | "BankAccountDetails", |
||
| 59 | _t( |
||
| 60 | "SilverShop\\Extension\\ShopConfigExtension.BankAccountDetails", |
||
| 61 | "Bank Account Details" |
||
| 62 | ) |
||
| 63 | )->setDescription( |
||
| 64 | _t( |
||
| 65 | "SilverShop\\Extension\\ShopConfigExtension.BankAccountDetailsDescription", |
||
| 66 | "Account Name, Bank Name, Branch, Branch Address" |
||
| 67 | ) |
||
| 68 | ), |
||
| 69 | HtmlEditorField::create( |
||
| 70 | "BankAccountInvoiceMessage", |
||
| 71 | _t( |
||
| 72 | "SilverShop\\Extension\\ShopConfigExtension.BankAccountInvoiceMessage", |
||
| 73 | "Bank Account Order/Invoice Message" |
||
| 74 | ) |
||
| 75 | )->setDescription( |
||
| 76 | _t( |
||
| 77 | "SilverShop\\Extension\\ShopConfigExtension.BankAccountInvoiceMessageDescription", |
||
| 78 | "Message to appear on the order/invoice" |
||
| 79 | ) |
||
| 85 |