| Conditions | 1 |
| Paths | 1 |
| Total Lines | 103 |
| Code Lines | 77 |
| 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 |
||
| 38 | public function get_customer_meta_fields() { |
||
| 39 | $show_fields = apply_filters('woocommerce_customer_meta_fields', array( |
||
| 40 | 'billing' => array( |
||
| 41 | 'title' => __( 'Customer Billing Address', 'woocommerce' ), |
||
| 42 | 'fields' => array( |
||
| 43 | 'billing_first_name' => array( |
||
| 44 | 'label' => __( 'First name', 'woocommerce' ), |
||
| 45 | 'description' => '' |
||
| 46 | ), |
||
| 47 | 'billing_last_name' => array( |
||
| 48 | 'label' => __( 'Last name', 'woocommerce' ), |
||
| 49 | 'description' => '' |
||
| 50 | ), |
||
| 51 | 'billing_company' => array( |
||
| 52 | 'label' => __( 'Company', 'woocommerce' ), |
||
| 53 | 'description' => '' |
||
| 54 | ), |
||
| 55 | 'billing_address_1' => array( |
||
| 56 | 'label' => __( 'Address 1', 'woocommerce' ), |
||
| 57 | 'description' => '' |
||
| 58 | ), |
||
| 59 | 'billing_address_2' => array( |
||
| 60 | 'label' => __( 'Address 2', 'woocommerce' ), |
||
| 61 | 'description' => '' |
||
| 62 | ), |
||
| 63 | 'billing_city' => array( |
||
| 64 | 'label' => __( 'City', 'woocommerce' ), |
||
| 65 | 'description' => '' |
||
| 66 | ), |
||
| 67 | 'billing_postcode' => array( |
||
| 68 | 'label' => __( 'Postcode', 'woocommerce' ), |
||
| 69 | 'description' => '' |
||
| 70 | ), |
||
| 71 | 'billing_country' => array( |
||
| 72 | 'label' => __( 'Country', 'woocommerce' ), |
||
| 73 | 'description' => '', |
||
| 74 | 'class' => 'js_field-country', |
||
| 75 | 'type' => 'select', |
||
| 76 | 'options' => array( '' => __( 'Select a country…', 'woocommerce' ) ) + WC()->countries->get_allowed_countries() |
||
| 77 | ), |
||
| 78 | 'billing_state' => array( |
||
| 79 | 'label' => __( 'State/County', 'woocommerce' ), |
||
| 80 | 'description' => __( 'State/County or state code', 'woocommerce' ), |
||
| 81 | 'class' => 'js_field-state' |
||
| 82 | ), |
||
| 83 | 'billing_phone' => array( |
||
| 84 | 'label' => __( 'Telephone', 'woocommerce' ), |
||
| 85 | 'description' => '' |
||
| 86 | ), |
||
| 87 | 'billing_email' => array( |
||
| 88 | 'label' => __( 'Email', 'woocommerce' ), |
||
| 89 | 'description' => '' |
||
| 90 | ) |
||
| 91 | ) |
||
| 92 | ), |
||
| 93 | 'shipping' => array( |
||
| 94 | 'title' => __( 'Customer Shipping Address', 'woocommerce' ), |
||
| 95 | 'fields' => array( |
||
| 96 | 'shipping_first_name' => array( |
||
| 97 | 'label' => __( 'First name', 'woocommerce' ), |
||
| 98 | 'description' => '' |
||
| 99 | ), |
||
| 100 | 'shipping_last_name' => array( |
||
| 101 | 'label' => __( 'Last name', 'woocommerce' ), |
||
| 102 | 'description' => '' |
||
| 103 | ), |
||
| 104 | 'shipping_company' => array( |
||
| 105 | 'label' => __( 'Company', 'woocommerce' ), |
||
| 106 | 'description' => '' |
||
| 107 | ), |
||
| 108 | 'shipping_address_1' => array( |
||
| 109 | 'label' => __( 'Address 1', 'woocommerce' ), |
||
| 110 | 'description' => '' |
||
| 111 | ), |
||
| 112 | 'shipping_address_2' => array( |
||
| 113 | 'label' => __( 'Address 2', 'woocommerce' ), |
||
| 114 | 'description' => '' |
||
| 115 | ), |
||
| 116 | 'shipping_city' => array( |
||
| 117 | 'label' => __( 'City', 'woocommerce' ), |
||
| 118 | 'description' => '' |
||
| 119 | ), |
||
| 120 | 'shipping_postcode' => array( |
||
| 121 | 'label' => __( 'Postcode', 'woocommerce' ), |
||
| 122 | 'description' => '' |
||
| 123 | ), |
||
| 124 | 'shipping_country' => array( |
||
| 125 | 'label' => __( 'Country', 'woocommerce' ), |
||
| 126 | 'description' => '', |
||
| 127 | 'class' => 'js_field-country', |
||
| 128 | 'type' => 'select', |
||
| 129 | 'options' => array( '' => __( 'Select a country…', 'woocommerce' ) ) + WC()->countries->get_allowed_countries() |
||
| 130 | ), |
||
| 131 | 'shipping_state' => array( |
||
| 132 | 'label' => __( 'State/County', 'woocommerce' ), |
||
| 133 | 'description' => __( 'State/County or state code', 'woocommerce' ), |
||
| 134 | 'class' => 'js_field-state' |
||
| 135 | ) |
||
| 136 | ) |
||
| 137 | ) |
||
| 138 | ) ); |
||
| 139 | return $show_fields; |
||
| 140 | } |
||
| 141 | |||
| 214 |