| Conditions | 1 |
| Paths | 1 |
| Total Lines | 72 |
| Code Lines | 51 |
| 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 |
||
| 39 | public function fields( array $fields ) { |
||
| 40 | // Merchant ID |
||
| 41 | $fields[] = array( |
||
| 42 | 'filter' => FILTER_SANITIZE_STRING, |
||
| 43 | 'section' => 'omnikassa', |
||
| 44 | 'meta_key' => '_pronamic_gateway_omnikassa_merchant_id', |
||
| 45 | 'title' => __( 'Merchant ID', 'pronamic_ideal' ), |
||
| 46 | 'type' => 'text', |
||
| 47 | 'classes' => array( 'code' ), |
||
| 48 | ); |
||
| 49 | |||
| 50 | // Secret Key |
||
| 51 | $fields[] = array( |
||
| 52 | 'filter' => FILTER_SANITIZE_STRING, |
||
| 53 | 'section' => 'omnikassa', |
||
| 54 | 'meta_key' => '_pronamic_gateway_omnikassa_secret_key', |
||
| 55 | 'title' => __( 'Secret Key', 'pronamic_ideal' ), |
||
| 56 | 'type' => 'text', |
||
| 57 | 'classes' => array( 'large-text', 'code' ), |
||
| 58 | ); |
||
| 59 | |||
| 60 | // Key Version |
||
| 61 | $fields[] = array( |
||
| 62 | 'filter' => FILTER_SANITIZE_STRING, |
||
| 63 | 'section' => 'omnikassa', |
||
| 64 | 'meta_key' => '_pronamic_gateway_omnikassa_key_version', |
||
| 65 | 'title' => __( 'Key Version', 'pronamic_ideal' ), |
||
| 66 | 'type' => 'text', |
||
| 67 | 'classes' => array( 'code' ), |
||
| 68 | 'size' => 5, |
||
| 69 | '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/' ), |
||
| 70 | ); |
||
| 71 | |||
| 72 | // Transaction feedback |
||
| 73 | $fields[] = array( |
||
| 74 | 'section' => 'omnikassa', |
||
| 75 | 'title' => __( 'Transaction feedback', 'pronamic_ideal' ), |
||
| 76 | 'type' => 'description', |
||
| 77 | 'html' => sprintf( |
||
| 78 | '<span class="dashicons dashicons-yes"></span> %s', |
||
| 79 | __( 'Payment status updates will be processed without any additional configuration.', 'pronamic_ideal' ) |
||
| 80 | ), |
||
| 81 | ); |
||
| 82 | |||
| 83 | // Purchase ID |
||
| 84 | $fields[] = array( |
||
| 85 | 'filter' => FILTER_SANITIZE_STRING, |
||
| 86 | 'section' => 'omnikassa_advanced', |
||
| 87 | 'meta_key' => '_pronamic_gateway_omnikassa_order_id', |
||
| 88 | 'title' => __( 'Order ID', 'pronamic_ideal' ), |
||
| 89 | 'type' => 'text', |
||
| 90 | 'classes' => array( 'regular-text', 'code' ), |
||
| 91 | 'tooltip' => sprintf( |
||
| 92 | __( 'The OmniKassa %s parameter.', 'pronamic_ideal' ), |
||
| 93 | sprintf( '<code>%s</code>', 'orderId' ) |
||
| 94 | ), |
||
| 95 | 'description' => sprintf( |
||
| 96 | '%s %s<br />%s', |
||
| 97 | __( 'Available tags:', 'pronamic_ideal' ), |
||
| 98 | sprintf( |
||
| 99 | '<code>%s</code> <code>%s</code>', |
||
| 100 | '{order_id}', |
||
| 101 | '{payment_id}' |
||
| 102 | ), |
||
| 103 | sprintf( |
||
| 104 | __( 'Default: <code>%s</code>', 'pronamic_ideal' ), |
||
| 105 | '{payment_id}' |
||
| 106 | ) |
||
| 107 | ), |
||
| 108 | ); |
||
| 109 | |||
| 110 | return $fields; |
||
| 111 | } |
||
| 113 |