| Conditions | 1 |
| Paths | 1 |
| Total Lines | 52 |
| Code Lines | 35 |
| 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 |
||
| 44 | public function get_settings_fields() { |
||
| 45 | $fields = array(); |
||
| 46 | |||
| 47 | // Account ID |
||
| 48 | $fields[] = array( |
||
| 49 | 'section' => 'general', |
||
| 50 | 'filter' => FILTER_SANITIZE_STRING, |
||
| 51 | 'meta_key' => '_pronamic_gateway_multisafepay_account_id', |
||
| 52 | 'title' => __( 'Account ID', 'pronamic_ideal' ), |
||
| 53 | 'type' => 'text', |
||
| 54 | 'classes' => array( 'code' ), |
||
| 55 | 'tooltip' => sprintf( |
||
| 56 | '%s %s.', |
||
| 57 | __( 'Account ID', 'pronamic_ideal' ), |
||
| 58 | /* translators: %s: MultiSafepay */ |
||
| 59 | sprintf( __( 'as mentioned in the %s dashboard', 'pronamic_ideal' ), __( 'MultiSafepay', 'pronamic_ideal' ) ) |
||
| 60 | ), |
||
| 61 | ); |
||
| 62 | |||
| 63 | // Site ID |
||
| 64 | $fields[] = array( |
||
| 65 | 'section' => 'general', |
||
| 66 | 'filter' => FILTER_SANITIZE_STRING, |
||
| 67 | 'meta_key' => '_pronamic_gateway_multisafepay_site_id', |
||
| 68 | 'title' => __( 'Site ID', 'pronamic_ideal' ), |
||
| 69 | 'type' => 'text', |
||
| 70 | 'classes' => array( 'code' ), |
||
| 71 | 'tooltip' => sprintf( |
||
| 72 | '%s %s.', |
||
| 73 | __( 'Site ID', 'pronamic_ideal' ), |
||
| 74 | /* translators: %s: MultiSafepay */ |
||
| 75 | sprintf( __( 'as mentioned in the %s dashboard', 'pronamic_ideal' ), __( 'MultiSafepay', 'pronamic_ideal' ) ) |
||
| 76 | ), |
||
| 77 | ); |
||
| 78 | |||
| 79 | // Site Security Code |
||
| 80 | $fields[] = array( |
||
| 81 | 'section' => 'general', |
||
| 82 | 'filter' => FILTER_SANITIZE_STRING, |
||
| 83 | 'meta_key' => '_pronamic_gateway_multisafepay_site_code', |
||
| 84 | 'title' => __( 'Site Security Code', 'pronamic_ideal' ), |
||
| 85 | 'type' => 'text', |
||
| 86 | 'classes' => array( 'code' ), |
||
| 87 | 'tooltip' => sprintf( |
||
| 88 | '%s %s.', |
||
| 89 | __( 'Site Security Code', 'pronamic_ideal' ), |
||
| 90 | /* translators: %s: MultiSafepay */ |
||
| 91 | sprintf( __( 'as mentioned in the %s dashboard', 'pronamic_ideal' ), __( 'MultiSafepay', 'pronamic_ideal' ) ) |
||
| 92 | ), |
||
| 93 | ); |
||
| 94 | |||
| 95 | return $fields; |
||
| 96 | } |
||
| 98 |