Conditions | 1 |
Paths | 1 |
Total Lines | 63 |
Code Lines | 45 |
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 |
||
42 | public function get_settings_fields() { |
||
43 | $fields = array(); |
||
44 | |||
45 | // Merchant ID |
||
46 | $fields[] = array( |
||
47 | 'section' => 'general', |
||
48 | 'filter' => FILTER_SANITIZE_STRING, |
||
49 | 'meta_key' => '_pronamic_gateway_omnikassa_merchant_id', |
||
50 | 'title' => __( 'Merchant ID', 'pronamic_ideal' ), |
||
51 | 'type' => 'text', |
||
52 | 'classes' => array( 'code' ), |
||
53 | ); |
||
54 | |||
55 | // Secret Key |
||
56 | $fields[] = array( |
||
57 | 'section' => 'general', |
||
58 | 'filter' => FILTER_SANITIZE_STRING, |
||
59 | 'meta_key' => '_pronamic_gateway_omnikassa_secret_key', |
||
60 | 'title' => __( 'Secret Key', 'pronamic_ideal' ), |
||
61 | 'type' => 'text', |
||
62 | 'classes' => array( 'large-text', 'code' ), |
||
63 | ); |
||
64 | |||
65 | // Key Version |
||
66 | $fields[] = array( |
||
67 | 'section' => 'general', |
||
68 | 'filter' => FILTER_SANITIZE_STRING, |
||
69 | 'meta_key' => '_pronamic_gateway_omnikassa_key_version', |
||
70 | 'title' => __( 'Key Version', 'pronamic_ideal' ), |
||
71 | 'type' => 'text', |
||
72 | 'classes' => array( 'code' ), |
||
73 | 'size' => 5, |
||
74 | 'description' => sprintf( __( 'You can find the key version in the <a href="%s" target="_blank">OmniKassa Download Dashboard</a>.', 'pronamic_ideal' ), 'https://download.omnikassa.rabobank.nl/' ), |
||
75 | ); |
||
76 | |||
77 | // Purchase ID |
||
78 | $fields[] = array( |
||
79 | 'section' => 'advanced', |
||
80 | 'filter' => FILTER_SANITIZE_STRING, |
||
81 | 'meta_key' => '_pronamic_gateway_omnikassa_order_id', |
||
82 | 'title' => __( 'Order ID', 'pronamic_ideal' ), |
||
83 | 'type' => 'text', |
||
84 | 'classes' => array( 'regular-text', 'code' ), |
||
85 | 'tooltip' => sprintf( |
||
86 | __( 'The OmniKassa %s parameter.', 'pronamic_ideal' ), |
||
87 | sprintf( '<code>%s</code>', 'orderId' ) |
||
88 | ), |
||
89 | 'description' => sprintf( |
||
90 | '%s %s<br />%s', |
||
91 | __( 'Available tags:', 'pronamic_ideal' ), |
||
92 | sprintf( |
||
93 | '<code>%s</code> <code>%s</code>', |
||
94 | '{order_id}', |
||
95 | '{payment_id}' |
||
96 | ), |
||
97 | sprintf( |
||
98 | __( 'Default: <code>%s</code>', 'pronamic_ideal' ), |
||
99 | '{payment_id}' |
||
100 | ) |
||
101 | ), |
||
102 | ); |
||
103 | |||
104 | return $fields; |
||
105 | } |
||
119 |