@@ -37,7 +37,7 @@ |
||
37 | 37 | * @param mixed $default Default to return if not set. |
38 | 38 | */ |
39 | 39 | protected function get_param( $name, $default = null ) { |
40 | - return isset( $this->request[ $name ] ) ? $this->request[ $name ] : $default; |
|
40 | + return isset( $this->request[$name] ) ? $this->request[$name] : $default; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -128,11 +128,11 @@ discard block |
||
128 | 128 | switch ( $prop ) { |
129 | 129 | case 'date_created': |
130 | 130 | case 'date_created_gmt': |
131 | - $prop_values[ $prop ] = rest_parse_date( $value ); |
|
131 | + $prop_values[$prop] = rest_parse_date( $value ); |
|
132 | 132 | break; |
133 | 133 | case 'upsell_ids': |
134 | 134 | case 'cross_sell_ids': |
135 | - $prop_values[ $prop ] = wp_parse_id_list( $value ); |
|
135 | + $prop_values[$prop] = wp_parse_id_list( $value ); |
|
136 | 136 | break; |
137 | 137 | case 'images': |
138 | 138 | $images = $this->parse_images_field( $value, $object ); |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $prop_values['shipping_class_id'] = $this->parse_shipping_class( $value, $object ); |
156 | 156 | break; |
157 | 157 | default: |
158 | - $prop_values[ $prop ] = $value; |
|
158 | + $prop_values[$prop] = $value; |
|
159 | 159 | } |
160 | 160 | } |
161 | 161 | |
@@ -479,8 +479,8 @@ discard block |
||
479 | 479 | continue; |
480 | 480 | } |
481 | 481 | |
482 | - if ( isset( $attributes[ $attribute_name ] ) ) { |
|
483 | - $_attribute = $attributes[ $attribute_name ]; |
|
482 | + if ( isset( $attributes[$attribute_name] ) ) { |
|
483 | + $_attribute = $attributes[$attribute_name]; |
|
484 | 484 | |
485 | 485 | if ( $_attribute['is_variation'] ) { |
486 | 486 | $value = isset( $attribute['option'] ) ? wc_clean( stripslashes( $attribute['option'] ) ) : ''; |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | } |
498 | 498 | |
499 | 499 | if ( $value ) { |
500 | - $default_attributes[ $attribute_name ] = $value; |
|
500 | + $default_attributes[$attribute_name] = $value; |
|
501 | 501 | } |
502 | 502 | } |
503 | 503 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | foreach ( $request_props as $prop => $value ) { |
57 | 57 | switch ( $prop ) { |
58 | 58 | case 'customer_id': |
59 | - $prop_values[ $prop ] = $this->parse_customer_id_field( $value ); |
|
59 | + $prop_values[$prop] = $this->parse_customer_id_field( $value ); |
|
60 | 60 | break; |
61 | 61 | case 'billing': |
62 | 62 | case 'shipping': |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $prop_values = array_merge( $prop_values, $address ); |
65 | 65 | break; |
66 | 66 | default: |
67 | - $prop_values[ $prop ] = $value; |
|
67 | + $prop_values[$prop] = $value; |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 | |
@@ -86,10 +86,10 @@ discard block |
||
86 | 86 | ]; |
87 | 87 | |
88 | 88 | foreach ( $types as $type ) { |
89 | - if ( ! isset( $this->request[ $type ] ) || ! is_array( $this->request[ $type ] ) ) { |
|
89 | + if ( ! isset( $this->request[$type] ) || ! is_array( $this->request[$type] ) ) { |
|
90 | 90 | continue; |
91 | 91 | } |
92 | - $items = $this->request[ $type ]; |
|
92 | + $items = $this->request[$type]; |
|
93 | 93 | |
94 | 94 | foreach ( $items as $item ) { |
95 | 95 | if ( ! is_array( $item ) ) { |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | $keys = array( 'product_id', 'method_id', 'method_title', 'name', 'code' ); |
116 | 116 | |
117 | 117 | foreach ( $keys as $key ) { |
118 | - if ( array_key_exists( $key, $item ) && is_null( $item[ $key ] ) ) { |
|
118 | + if ( array_key_exists( $key, $item ) && is_null( $item[$key] ) ) { |
|
119 | 119 | return true; |
120 | 120 | } |
121 | 121 | } |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | * @param array $posted Request data. |
132 | 132 | */ |
133 | 133 | protected function maybe_set_item_prop( $item, $prop, $posted ) { |
134 | - if ( isset( $posted[ $prop ] ) ) { |
|
135 | - $item->{"set_$prop"}( $posted[ $prop ] ); |
|
134 | + if ( isset( $posted[$prop] ) ) { |
|
135 | + $item->{"set_$prop"}( $posted[$prop] ); |
|
136 | 136 | } |
137 | 137 | } |
138 | 138 | |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | $address = []; |
319 | 319 | foreach ( $data as $key => $value ) { |
320 | 320 | if ( is_callable( array( $object, "set_{$type}_{$key}" ) ) ) { |
321 | - $address[ "{$type}_{$key}" ] = $value; |
|
321 | + $address["{$type}_{$key}"] = $value; |
|
322 | 322 | } |
323 | 323 | } |
324 | 324 | return $address; |
@@ -308,10 +308,10 @@ |
||
308 | 308 | $attribute = false; |
309 | 309 | |
310 | 310 | // pa_ attributes. |
311 | - if ( isset( $attributes[ wc_attribute_taxonomy_name( $slug ) ] ) ) { |
|
312 | - $attribute = $attributes[ wc_attribute_taxonomy_name( $slug ) ]; |
|
313 | - } elseif ( isset( $attributes[ $slug ] ) ) { |
|
314 | - $attribute = $attributes[ $slug ]; |
|
311 | + if ( isset( $attributes[wc_attribute_taxonomy_name( $slug )] ) ) { |
|
312 | + $attribute = $attributes[wc_attribute_taxonomy_name( $slug )]; |
|
313 | + } elseif ( isset( $attributes[$slug] ) ) { |
|
314 | + $attribute = $attributes[$slug]; |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | if ( ! $attribute ) { |
@@ -52,14 +52,14 @@ discard block |
||
52 | 52 | |
53 | 53 | // Format decimal values. |
54 | 54 | foreach ( $format_decimal as $key ) { |
55 | - $data[ $key ] = wc_format_decimal( $data[ $key ], $this->dp ); |
|
55 | + $data[$key] = wc_format_decimal( $data[$key], $this->dp ); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | // Format date values. |
59 | 59 | foreach ( $format_date as $key ) { |
60 | - $datetime = $data[ $key ]; |
|
61 | - $data[ $key ] = wc_rest_prepare_date_response( $datetime, false ); |
|
62 | - $data[ $key . '_gmt' ] = wc_rest_prepare_date_response( $datetime ); |
|
60 | + $datetime = $data[$key]; |
|
61 | + $data[$key] = wc_rest_prepare_date_response( $datetime, false ); |
|
62 | + $data[$key . '_gmt'] = wc_rest_prepare_date_response( $datetime ); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | // Format the order status. |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | |
68 | 68 | // Format line items. |
69 | 69 | foreach ( $format_line_items as $key ) { |
70 | - $data[ $key ] = array_values( array_map( array( $this, 'prepare_order_item_data' ), $data[ $key ] ) ); |
|
70 | + $data[$key] = array_values( array_map( array( $this, 'prepare_order_item_data' ), $data[$key] ) ); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | // Refunds. |
@@ -142,8 +142,8 @@ discard block |
||
142 | 142 | |
143 | 143 | // Format decimal values. |
144 | 144 | foreach ( $format_decimal as $key ) { |
145 | - if ( isset( $data[ $key ] ) ) { |
|
146 | - $data[ $key ] = wc_format_decimal( $data[ $key ], $this->dp ); |
|
145 | + if ( isset( $data[$key] ) ) { |
|
146 | + $data[$key] = wc_format_decimal( $data[$key], $this->dp ); |
|
147 | 147 | } |
148 | 148 | } |
149 | 149 | |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | $taxes[] = array( |
162 | 162 | 'id' => $tax_rate_id, |
163 | 163 | 'total' => $tax, |
164 | - 'subtotal' => isset( $data['taxes']['subtotal'][ $tax_rate_id ] ) ? $data['taxes']['subtotal'][ $tax_rate_id ] : '', |
|
164 | + 'subtotal' => isset( $data['taxes']['subtotal'][$tax_rate_id] ) ? $data['taxes']['subtotal'][$tax_rate_id] : '', |
|
165 | 165 | ); |
166 | 166 | } |
167 | 167 | $data['taxes'] = $taxes; |
@@ -68,7 +68,7 @@ |
||
68 | 68 | $response = array(); |
69 | 69 | |
70 | 70 | foreach ( $mappings as $section => $values ) { |
71 | - $response[ $section ] = $values; |
|
71 | + $response[$section] = $values; |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | $response = $this->prepare_item_for_response( $response, $request ); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * @return array |
37 | 37 | */ |
38 | 38 | public function get_active_plugin_data() { |
39 | - return array_map( [ $this, 'format_plugin_data' ], array_map( [ $this, 'get_plugin_data' ], $this->get_active_plugins() ) ); |
|
39 | + return array_map( [$this, 'format_plugin_data'], array_map( [$this, 'get_plugin_data'], $this->get_active_plugins() ) ); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @return array |
46 | 46 | */ |
47 | 47 | public function get_inactive_plugin_data() { |
48 | - return array_map( [ $this, 'format_plugin_data' ], array_map( [ $this, 'get_plugin_data' ], $this->get_inactive_plugins() ) ); |
|
48 | + return array_map( [$this, 'format_plugin_data'], array_map( [$this, 'get_plugin_data'], $this->get_inactive_plugins() ) ); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | /** |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * @return array |
56 | 56 | */ |
57 | 57 | public function get_dropin_and_mu_plugin_data() { |
58 | - $plugins = [ |
|
58 | + $plugins = [ |
|
59 | 59 | 'dropins' => [], |
60 | 60 | 'mu_plugins' => [], |
61 | 61 | ]; |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | $version_latest = $data['Version']; |
132 | 132 | |
133 | 133 | // Find latest version. |
134 | - if ( isset( $this->available_updates[ $data['plugin_file'] ]->update->new_version ) ) { |
|
135 | - $version_latest = $this->available_updates[ $data['plugin_file'] ]->update->new_version; |
|
134 | + if ( isset( $this->available_updates[$data['plugin_file']]->update->new_version ) ) { |
|
135 | + $version_latest = $this->available_updates[$data['plugin_file']]->update->new_version; |
|
136 | 136 | } |
137 | 137 | |
138 | 138 | return array( |
@@ -23,14 +23,14 @@ |
||
23 | 23 | $term_response = array(); |
24 | 24 | $terms = get_terms( 'product_type', array( 'hide_empty' => 0 ) ); |
25 | 25 | foreach ( $terms as $term ) { |
26 | - $term_response[ $term->slug ] = strtolower( $term->name ); |
|
26 | + $term_response[$term->slug] = strtolower( $term->name ); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | // Get a list of terms used for product visibility. |
30 | 30 | $product_visibility_terms = array(); |
31 | 31 | $terms = get_terms( 'product_visibility', array( 'hide_empty' => 0 ) ); |
32 | 32 | foreach ( $terms as $term ) { |
33 | - $product_visibility_terms[ $term->slug ] = strtolower( $term->name ); |
|
33 | + $product_visibility_terms[$term->slug] = strtolower( $term->name ); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | // Check if WooCommerce.com account is connected. |
@@ -96,7 +96,7 @@ |
||
96 | 96 | } |
97 | 97 | $table_type = in_array( $table->name, $core_tables, true ) ? 'woocommerce' : 'other'; |
98 | 98 | |
99 | - $tables[ $table_type ][ $table->name ] = array( |
|
99 | + $tables[$table_type][$table->name] = array( |
|
100 | 100 | 'data' => $table->data, |
101 | 101 | 'index' => $table->index, |
102 | 102 | 'engine' => $table->engine, |