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