@@ -46,25 +46,25 @@ |
||
46 | 46 | public function get_public_item_schema() { |
47 | 47 | $schema = parent::get_public_item_schema(); |
48 | 48 | |
49 | - $schema['properties']['blog'] = array( |
|
49 | + $schema['properties']['blog'] = array( |
|
50 | 50 | 'description' => __( 'Blog id of the record on the multisite.', 'woocommerce' ), |
51 | 51 | 'type' => 'integer', |
52 | 52 | 'context' => array( 'view' ), |
53 | 53 | 'readonly' => true, |
54 | 54 | ); |
55 | - $schema['properties']['edit_url'] = array( |
|
55 | + $schema['properties']['edit_url'] = array( |
|
56 | 56 | 'description' => __( 'URL to edit the order', 'woocommerce' ), |
57 | 57 | 'type' => 'string', |
58 | 58 | 'context' => array( 'view' ), |
59 | 59 | 'readonly' => true, |
60 | 60 | ); |
61 | - $schema['properties']['customer'][] = array( |
|
61 | + $schema['properties']['customer'][] = array( |
|
62 | 62 | 'description' => __( 'Name of the customer for the order', 'woocommerce' ), |
63 | 63 | 'type' => 'string', |
64 | 64 | 'context' => array( 'view' ), |
65 | 65 | 'readonly' => true, |
66 | 66 | ); |
67 | - $schema['properties']['status_name'][] = array( |
|
67 | + $schema['properties']['status_name'][] = array( |
|
68 | 68 | 'description' => __( 'Order Status', 'woocommerce' ), |
69 | 69 | 'type' => 'string', |
70 | 70 | 'context' => array( 'view' ), |
@@ -166,17 +166,17 @@ discard block |
||
166 | 166 | if ( isset( $request['settings'] ) ) { |
167 | 167 | $errors_found = false; |
168 | 168 | foreach ( $gateway->form_fields as $key => $field ) { |
169 | - if ( isset( $request['settings'][ $key ] ) ) { |
|
169 | + if ( isset( $request['settings'][$key] ) ) { |
|
170 | 170 | if ( is_callable( array( $this, 'validate_setting_' . $field['type'] . '_field' ) ) ) { |
171 | - $value = $this->{'validate_setting_' . $field['type'] . '_field'}( $request['settings'][ $key ], $field ); |
|
171 | + $value = $this->{'validate_setting_' . $field['type'] . '_field'}( $request['settings'][$key], $field ); |
|
172 | 172 | } else { |
173 | - $value = $this->validate_setting_text_field( $request['settings'][ $key ], $field ); |
|
173 | + $value = $this->validate_setting_text_field( $request['settings'][$key], $field ); |
|
174 | 174 | } |
175 | 175 | if ( is_wp_error( $value ) ) { |
176 | 176 | $errors_found = true; |
177 | 177 | break; |
178 | 178 | } |
179 | - $settings[ $key ] = $value; |
|
179 | + $settings[$key] = $value; |
|
180 | 180 | } |
181 | 181 | } |
182 | 182 | |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | // Update order. |
211 | 211 | if ( isset( $request['order'] ) ) { |
212 | 212 | $order = (array) get_option( 'woocommerce_gateway_order' ); |
213 | - $order[ $gateway->id ] = $request['order']; |
|
213 | + $order[$gateway->id] = $request['order']; |
|
214 | 214 | update_option( 'woocommerce_gateway_order', $order ); |
215 | 215 | $gateway->order = absint( $request['order'] ); |
216 | 216 | } |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | 'id' => $gateway->id, |
252 | 252 | 'title' => $gateway->title, |
253 | 253 | 'description' => $gateway->description, |
254 | - 'order' => isset( $order[ $gateway->id ] ) ? $order[ $gateway->id ] : '', |
|
254 | + 'order' => isset( $order[$gateway->id] ) ? $order[$gateway->id] : '', |
|
255 | 255 | 'enabled' => ( 'yes' === $gateway->enabled ), |
256 | 256 | 'method_title' => $gateway->get_method_title(), |
257 | 257 | 'method_description' => $gateway->get_method_description(), |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | 'label' => empty( $field['label'] ) ? $field['title'] : $field['label'], |
303 | 303 | 'description' => empty( $field['description'] ) ? '' : $field['description'], |
304 | 304 | 'type' => $field['type'], |
305 | - 'value' => empty( $gateway->settings[ $id ] ) ? '' : $gateway->settings[ $id ], |
|
305 | + 'value' => empty( $gateway->settings[$id] ) ? '' : $gateway->settings[$id], |
|
306 | 306 | 'default' => empty( $field['default'] ) ? '' : $field['default'], |
307 | 307 | 'tip' => empty( $field['description'] ) ? '' : $field['description'], |
308 | 308 | 'placeholder' => empty( $field['placeholder'] ) ? '' : $field['placeholder'], |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | if ( ! empty( $field['options'] ) ) { |
311 | 311 | $data['options'] = $field['options']; |
312 | 312 | } |
313 | - $settings[ $id ] = $data; |
|
313 | + $settings[$id] = $data; |
|
314 | 314 | } |
315 | 315 | return $settings; |
316 | 316 | } |
@@ -90,7 +90,7 @@ |
||
90 | 90 | |
91 | 91 | $currency = array( |
92 | 92 | 'code' => $code, |
93 | - 'name' => $currencies[ $code ], |
|
93 | + 'name' => $currencies[$code], |
|
94 | 94 | 'symbol' => get_woocommerce_currency_symbol( $code ), |
95 | 95 | ); |
96 | 96 |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | return false; |
83 | 83 | } |
84 | 84 | |
85 | - $continent_list = $continents[ $continent_code ]; |
|
85 | + $continent_list = $continents[$continent_code]; |
|
86 | 86 | |
87 | 87 | $continent = array( |
88 | 88 | 'code' => $continent_code, |
@@ -91,17 +91,17 @@ discard block |
||
91 | 91 | |
92 | 92 | $local_countries = array(); |
93 | 93 | foreach ( $continent_list['countries'] as $country_code ) { |
94 | - if ( isset( $countries[ $country_code ] ) ) { |
|
94 | + if ( isset( $countries[$country_code] ) ) { |
|
95 | 95 | $country = array( |
96 | 96 | 'code' => $country_code, |
97 | - 'name' => $countries[ $country_code ], |
|
97 | + 'name' => $countries[$country_code], |
|
98 | 98 | ); |
99 | 99 | |
100 | 100 | // If we have detailed locale information include that in the response. |
101 | 101 | if ( array_key_exists( $country_code, $locale_info ) ) { |
102 | 102 | // Defensive programming against unexpected changes in locale-info.php. |
103 | 103 | $country_data = wp_parse_args( |
104 | - $locale_info[ $country_code ], |
|
104 | + $locale_info[$country_code], |
|
105 | 105 | array( |
106 | 106 | 'currency_code' => 'USD', |
107 | 107 | 'currency_pos' => 'left', |
@@ -117,8 +117,8 @@ discard block |
||
117 | 117 | } |
118 | 118 | |
119 | 119 | $local_states = array(); |
120 | - if ( isset( $states[ $country_code ] ) ) { |
|
121 | - foreach ( $states[ $country_code ] as $state_code => $state_name ) { |
|
120 | + if ( isset( $states[$country_code] ) ) { |
|
121 | + foreach ( $states[$country_code] as $state_code => $state_name ) { |
|
122 | 122 | $local_states[] = array( |
123 | 123 | 'code' => $state_code, |
124 | 124 | 'name' => $state_name, |
@@ -81,12 +81,12 @@ |
||
81 | 81 | |
82 | 82 | $country = array( |
83 | 83 | 'code' => $country_code, |
84 | - 'name' => $countries[ $country_code ], |
|
84 | + 'name' => $countries[$country_code], |
|
85 | 85 | ); |
86 | 86 | |
87 | 87 | $local_states = array(); |
88 | - if ( isset( $states[ $country_code ] ) ) { |
|
89 | - foreach ( $states[ $country_code ] as $state_code => $state_name ) { |
|
88 | + if ( isset( $states[$country_code] ) ) { |
|
89 | + foreach ( $states[$country_code] as $state_code => $state_name ) { |
|
90 | 90 | $local_states[] = array( |
91 | 91 | 'code' => $state_code, |
92 | 92 | 'name' => $state_name, |
@@ -117,11 +117,11 @@ |
||
117 | 117 | public function get_item( $request ) { |
118 | 118 | $wc_shipping = \WC_Shipping::instance(); |
119 | 119 | $methods = $wc_shipping->get_shipping_methods(); |
120 | - if ( empty( $methods[ $request['id'] ] ) ) { |
|
120 | + if ( empty( $methods[$request['id']] ) ) { |
|
121 | 121 | return new \WP_Error( 'woocommerce_rest_shipping_method_invalid', __( 'Resource does not exist.', 'woocommerce' ), array( 'status' => 404 ) ); |
122 | 122 | } |
123 | 123 | |
124 | - $method = $methods[ $request['id'] ]; |
|
124 | + $method = $methods[$request['id']]; |
|
125 | 125 | $response = $this->prepare_item_for_response( $method, $request ); |
126 | 126 | |
127 | 127 | return rest_ensure_response( $response ); |
@@ -259,15 +259,15 @@ discard block |
||
259 | 259 | * set the parameter's value on the query $prepared_args. |
260 | 260 | */ |
261 | 261 | foreach ( $parameter_mappings as $api_param => $wp_param ) { |
262 | - if ( isset( $registered[ $api_param ], $request[ $api_param ] ) ) { |
|
263 | - $prepared_args[ $wp_param ] = $request[ $api_param ]; |
|
262 | + if ( isset( $registered[$api_param], $request[$api_param] ) ) { |
|
263 | + $prepared_args[$wp_param] = $request[$api_param]; |
|
264 | 264 | } |
265 | 265 | } |
266 | 266 | |
267 | 267 | // Ensure certain parameter values default to empty strings. |
268 | 268 | foreach ( array( 'author_email', 'search' ) as $param ) { |
269 | - if ( ! isset( $prepared_args[ $param ] ) ) { |
|
270 | - $prepared_args[ $param ] = ''; |
|
269 | + if ( ! isset( $prepared_args[$param] ) ) { |
|
270 | + $prepared_args[$param] = ''; |
|
271 | 271 | } |
272 | 272 | } |
273 | 273 | |
@@ -894,7 +894,7 @@ discard block |
||
894 | 894 | $avatar_sizes = rest_get_avatar_sizes(); |
895 | 895 | |
896 | 896 | foreach ( $avatar_sizes as $size ) { |
897 | - $avatar_properties[ $size ] = array( |
|
897 | + $avatar_properties[$size] = array( |
|
898 | 898 | /* translators: %d: avatar image size in pixels */ |
899 | 899 | 'description' => sprintf( __( 'Avatar URL with image size of %d pixels.', 'woocommerce' ), $size ), |
900 | 900 | 'type' => 'string', |
@@ -924,17 +924,17 @@ discard block |
||
924 | 924 | |
925 | 925 | $params['context']['default'] = 'view'; |
926 | 926 | |
927 | - $params['after'] = array( |
|
927 | + $params['after'] = array( |
|
928 | 928 | 'description' => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce' ), |
929 | 929 | 'type' => 'string', |
930 | 930 | 'format' => 'date-time', |
931 | 931 | ); |
932 | - $params['before'] = array( |
|
932 | + $params['before'] = array( |
|
933 | 933 | 'description' => __( 'Limit response to reviews published before a given ISO8601 compliant date.', 'woocommerce' ), |
934 | 934 | 'type' => 'string', |
935 | 935 | 'format' => 'date-time', |
936 | 936 | ); |
937 | - $params['exclude'] = array( |
|
937 | + $params['exclude'] = array( |
|
938 | 938 | 'description' => __( 'Ensure result set excludes specific IDs.', 'woocommerce' ), |
939 | 939 | 'type' => 'array', |
940 | 940 | 'items' => array( |
@@ -942,7 +942,7 @@ discard block |
||
942 | 942 | ), |
943 | 943 | 'default' => array(), |
944 | 944 | ); |
945 | - $params['include'] = array( |
|
945 | + $params['include'] = array( |
|
946 | 946 | 'description' => __( 'Limit result set to specific IDs.', 'woocommerce' ), |
947 | 947 | 'type' => 'array', |
948 | 948 | 'items' => array( |
@@ -950,11 +950,11 @@ discard block |
||
950 | 950 | ), |
951 | 951 | 'default' => array(), |
952 | 952 | ); |
953 | - $params['offset'] = array( |
|
953 | + $params['offset'] = array( |
|
954 | 954 | 'description' => __( 'Offset the result set by a specific number of items.', 'woocommerce' ), |
955 | 955 | 'type' => 'integer', |
956 | 956 | ); |
957 | - $params['order'] = array( |
|
957 | + $params['order'] = array( |
|
958 | 958 | 'description' => __( 'Order sort attribute ascending or descending.', 'woocommerce' ), |
959 | 959 | 'type' => 'string', |
960 | 960 | 'default' => 'desc', |
@@ -963,7 +963,7 @@ discard block |
||
963 | 963 | 'desc', |
964 | 964 | ), |
965 | 965 | ); |
966 | - $params['orderby'] = array( |
|
966 | + $params['orderby'] = array( |
|
967 | 967 | 'description' => __( 'Sort collection by object attribute.', 'woocommerce' ), |
968 | 968 | 'type' => 'string', |
969 | 969 | 'default' => 'date_gmt', |
@@ -975,7 +975,7 @@ discard block |
||
975 | 975 | 'product', |
976 | 976 | ), |
977 | 977 | ); |
978 | - $params['reviewer'] = array( |
|
978 | + $params['reviewer'] = array( |
|
979 | 979 | 'description' => __( 'Limit result set to reviews assigned to specific user IDs.', 'woocommerce' ), |
980 | 980 | 'type' => 'array', |
981 | 981 | 'items' => array( |
@@ -989,13 +989,13 @@ discard block |
||
989 | 989 | 'type' => 'integer', |
990 | 990 | ), |
991 | 991 | ); |
992 | - $params['reviewer_email'] = array( |
|
992 | + $params['reviewer_email'] = array( |
|
993 | 993 | 'default' => null, |
994 | 994 | 'description' => __( 'Limit result set to that from a specific author email.', 'woocommerce' ), |
995 | 995 | 'format' => 'email', |
996 | 996 | 'type' => 'string', |
997 | 997 | ); |
998 | - $params['product'] = array( |
|
998 | + $params['product'] = array( |
|
999 | 999 | 'default' => array(), |
1000 | 1000 | 'description' => __( 'Limit result set to reviews assigned to specific product IDs.', 'woocommerce' ), |
1001 | 1001 | 'type' => 'array', |
@@ -1003,7 +1003,7 @@ discard block |
||
1003 | 1003 | 'type' => 'integer', |
1004 | 1004 | ), |
1005 | 1005 | ); |
1006 | - $params['status'] = array( |
|
1006 | + $params['status'] = array( |
|
1007 | 1007 | 'default' => 'approved', |
1008 | 1008 | 'description' => __( 'Limit result set to reviews assigned a specific status.', 'woocommerce' ), |
1009 | 1009 | 'sanitize_callback' => 'sanitize_key', |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | 'id' => 'tax_rate_id', |
215 | 215 | 'order' => 'tax_rate_order', |
216 | 216 | ); |
217 | - $prepared_args['orderby'] = $orderby_possibles[ $request['orderby'] ]; |
|
217 | + $prepared_args['orderby'] = $orderby_possibles[$request['orderby']]; |
|
218 | 218 | $prepared_args['class'] = $request['class']; |
219 | 219 | $prepared_args['code'] = $request['code']; |
220 | 220 | $prepared_args['include'] = $request['include']; |
@@ -329,12 +329,12 @@ discard block |
||
329 | 329 | $key = 'tax_rate' === $field ? 'rate' : str_replace( 'tax_rate_', '', $field ); |
330 | 330 | |
331 | 331 | // Remove data that was not posted. |
332 | - if ( ! isset( $request[ $key ] ) ) { |
|
332 | + if ( ! isset( $request[$key] ) ) { |
|
333 | 333 | continue; |
334 | 334 | } |
335 | 335 | |
336 | 336 | // Test new data against current data. |
337 | - if ( $current && $current->$field === $request[ $key ] ) { |
|
337 | + if ( $current && $current->$field === $request[$key] ) { |
|
338 | 338 | continue; |
339 | 339 | } |
340 | 340 | |
@@ -344,13 +344,13 @@ discard block |
||
344 | 344 | case 'tax_rate_compound': |
345 | 345 | case 'tax_rate_shipping': |
346 | 346 | case 'tax_rate_order': |
347 | - $data[ $field ] = absint( $request[ $key ] ); |
|
347 | + $data[$field] = absint( $request[$key] ); |
|
348 | 348 | break; |
349 | 349 | case 'tax_rate_class': |
350 | - $data[ $field ] = 'standard' !== $request['tax_rate_class'] ? $request['tax_rate_class'] : ''; |
|
350 | + $data[$field] = 'standard' !== $request['tax_rate_class'] ? $request['tax_rate_class'] : ''; |
|
351 | 351 | break; |
352 | 352 | default: |
353 | - $data[ $field ] = wc_clean( $request[ $key ] ); |
|
353 | + $data[$field] = wc_clean( $request[$key] ); |
|
354 | 354 | break; |
355 | 355 | } |
356 | 356 | } |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | |
544 | 544 | if ( ! is_wp_error( $tax ) && ! is_null( $tax ) ) { |
545 | 545 | foreach ( $locales as $locale ) { |
546 | - $data[ $locale->location_type ] = $locale->location_code; |
|
546 | + $data[$locale->location_type] = $locale->location_code; |
|
547 | 547 | } |
548 | 548 | } |
549 | 549 | |
@@ -727,7 +727,7 @@ discard block |
||
727 | 727 | 'type' => 'string', |
728 | 728 | 'validate_callback' => 'rest_validate_request_arg', |
729 | 729 | ); |
730 | - $params['code'] = array( |
|
730 | + $params['code'] = array( |
|
731 | 731 | 'description' => __( 'Search by similar tax code.', 'woocommerce' ), |
732 | 732 | 'type' => 'string', |
733 | 733 | 'validate_callback' => 'rest_validate_request_arg', |
@@ -37,8 +37,8 @@ |
||
37 | 37 | public function register_rest_routes() { |
38 | 38 | foreach ( $this->get_rest_namespaces() as $namespace => $controllers ) { |
39 | 39 | foreach ( $controllers as $controller_name => $controller_class ) { |
40 | - $this->controllers[ $namespace ][ $controller_name ] = new $controller_class(); |
|
41 | - $this->controllers[ $namespace ][ $controller_name ]->register_routes(); |
|
40 | + $this->controllers[$namespace][$controller_name] = new $controller_class(); |
|
41 | + $this->controllers[$namespace][$controller_name]->register_routes(); |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 | } |