Passed
Push — master ( fa0560...6b8bc5 )
by Mike
04:54 queued 31s
created
src/Controllers/Version4/Data/Countries.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -87,13 +87,13 @@  discard block
 block discarded – undo
87 87
 		$local_states = array();
88 88
 		if ( isset( $states[ $country_code ] ) ) {
89 89
 			foreach ( $states[ $country_code ] as $state_code => $state_name ) {
90
-				$local_states[] = array(
90
+				$local_states[ ] = array(
91 91
 					'code' => $state_code,
92 92
 					'name' => $state_name,
93 93
 				);
94 94
 			}
95 95
 		}
96
-		$country['states'] = $local_states;
96
+		$country[ 'states' ] = $local_states;
97 97
 		return $country;
98 98
 	}
99 99
 
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 		foreach ( array_keys( $countries ) as $country_code ) {
112 112
 			$country  = $this->get_country( $country_code, $request );
113 113
 			$response = $this->prepare_item_for_response( $country, $request );
114
-			$data[]   = $this->prepare_response_for_collection( $response );
114
+			$data[ ]   = $this->prepare_response_for_collection( $response );
115 115
 		}
116 116
 
117 117
 		return rest_ensure_response( $data );
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
 	 * @return \WP_Error|\WP_REST_Response
126 126
 	 */
127 127
 	public function get_item( $request ) {
128
-		$data = $this->get_country( strtoupper( $request['location'] ), $request );
128
+		$data = $this->get_country( strtoupper( $request[ 'location' ] ), $request );
129 129
 		if ( empty( $data ) ) {
130 130
 			return new \WP_Error( 'woocommerce_rest_data_invalid_location', __( 'There are no locations matching these parameters.', 'woocommerce' ), array( 'status' => 404 ) );
131 131
 		}
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	 * @return array
152 152
 	 */
153 153
 	protected function prepare_links( $item, $request ) {
154
-		$country_code = strtolower( $item['code'] );
154
+		$country_code = strtolower( $item[ 'code' ] );
155 155
 		$links        = array(
156 156
 			'self'       => array(
157 157
 				'href' => rest_url( sprintf( '/%s/%s/%s', $this->namespace, $this->rest_base, $country_code ) ),
Please login to merge, or discard this patch.
src/Controllers/Version4/Data/Continents.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -86,11 +86,11 @@  discard block
 block discarded – undo
86 86
 
87 87
 		$continent = array(
88 88
 			'code' => $continent_code,
89
-			'name' => $continent_list['name'],
89
+			'name' => $continent_list[ 'name' ],
90 90
 		);
91 91
 
92 92
 		$local_countries = array();
93
-		foreach ( $continent_list['countries'] as $country_code ) {
93
+		foreach ( $continent_list[ 'countries' ] as $country_code ) {
94 94
 			if ( isset( $countries[ $country_code ] ) ) {
95 95
 				$country = array(
96 96
 					'code' => $country_code,
@@ -119,13 +119,13 @@  discard block
 block discarded – undo
119 119
 				$local_states = array();
120 120
 				if ( isset( $states[ $country_code ] ) ) {
121 121
 					foreach ( $states[ $country_code ] as $state_code => $state_name ) {
122
-						$local_states[] = array(
122
+						$local_states[ ] = array(
123 123
 							'code' => $state_code,
124 124
 							'name' => $state_name,
125 125
 						);
126 126
 					}
127 127
 				}
128
-				$country['states'] = $local_states;
128
+				$country[ 'states' ] = $local_states;
129 129
 
130 130
 				// Allow only desired keys (e.g. filter out tax rates).
131 131
 				$allowed = array(
@@ -142,11 +142,11 @@  discard block
 block discarded – undo
142 142
 				);
143 143
 				$country = array_intersect_key( $country, array_flip( $allowed ) );
144 144
 
145
-				$local_countries[] = $country;
145
+				$local_countries[ ] = $country;
146 146
 			}
147 147
 		}
148 148
 
149
-		$continent['countries'] = $local_countries;
149
+		$continent[ 'countries' ] = $local_countries;
150 150
 		return $continent;
151 151
 	}
152 152
 
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
 		foreach ( array_keys( $continents ) as $continent_code ) {
165 165
 			$continent = $this->get_continent( $continent_code, $request );
166 166
 			$response  = $this->prepare_item_for_response( $continent, $request );
167
-			$data[]    = $this->prepare_response_for_collection( $response );
167
+			$data[ ]    = $this->prepare_response_for_collection( $response );
168 168
 		}
169 169
 
170 170
 		return rest_ensure_response( $data );
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 	 * @return \WP_Error|\WP_REST_Response
179 179
 	 */
180 180
 	public function get_item( $request ) {
181
-		$data = $this->get_continent( strtoupper( $request['location'] ), $request );
181
+		$data = $this->get_continent( strtoupper( $request[ 'location' ] ), $request );
182 182
 		if ( empty( $data ) ) {
183 183
 			return new \WP_Error( 'woocommerce_rest_data_invalid_location', __( 'There are no locations matching these parameters.', 'woocommerce' ), array( 'status' => 404 ) );
184 184
 		}
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 	 * @return array
205 205
 	 */
206 206
 	protected function prepare_links( $item, $request ) {
207
-		$continent_code = strtolower( $item['code'] );
207
+		$continent_code = strtolower( $item[ 'code' ] );
208 208
 		$links          = array(
209 209
 			'self'       => array(
210 210
 				'href' => rest_url( sprintf( '/%s/%s/%s', $this->namespace, $this->rest_base, $continent_code ) ),
Please login to merge, or discard this patch.
src/Controllers/Version4/AbstractObjectsController.php 1 patch
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	 * @return \WP_Error|\WP_REST_Response
66 66
 	 */
67 67
 	public function get_item( $request ) {
68
-		$object = $this->get_object( (int) $request['id'] );
68
+		$object = $this->get_object( (int) $request[ 'id' ] );
69 69
 
70 70
 		if ( ! $object || 0 === $object->get_id() ) {
71 71
 			return new \WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid ID.', 'woocommerce' ), array( 'status' => 404 ) );
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
 	 * @return \WP_Error|\WP_REST_Response
111 111
 	 */
112 112
 	public function create_item( $request ) {
113
-		if ( ! empty( $request['id'] ) ) {
113
+		if ( ! empty( $request[ 'id' ] ) ) {
114 114
 			/* translators: %s: post type */
115 115
 			return new \WP_Error( "woocommerce_rest_{$this->post_type}_exists", sprintf( __( 'Cannot create existing %s.', 'woocommerce' ), $this->post_type ), array( 'status' => 400 ) );
116 116
 		}
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 	 * @return \WP_Error|\WP_REST_Response
157 157
 	 */
158 158
 	public function update_item( $request ) {
159
-		$object = $this->get_object( (int) $request['id'] );
159
+		$object = $this->get_object( (int) $request[ 'id' ] );
160 160
 
161 161
 		if ( ! $object || 0 === $object->get_id() ) {
162 162
 			return new \WP_Error( "woocommerce_rest_{$this->post_type}_invalid_id", __( 'Invalid ID.', 'woocommerce' ), array( 'status' => 404 ) );
@@ -199,42 +199,42 @@  discard block
 block discarded – undo
199 199
 	 */
200 200
 	protected function prepare_objects_query( $request ) {
201 201
 		$args                        = array();
202
-		$args['offset']              = $request['offset'];
203
-		$args['order']               = $request['order'];
204
-		$args['orderby']             = $request['orderby'];
205
-		$args['paged']               = $request['page'];
206
-		$args['post__in']            = $request['include'];
207
-		$args['post__not_in']        = $request['exclude'];
208
-		$args['posts_per_page']      = $request['per_page'];
209
-		$args['name']                = $request['slug'];
210
-		$args['post_parent__in']     = $request['parent'];
211
-		$args['post_parent__not_in'] = $request['parent_exclude'];
212
-		$args['s']                   = $request['search'];
213
-		$args['fields']              = 'ids';
214
-
215
-		if ( 'date' === $args['orderby'] ) {
216
-			$args['orderby'] = 'date ID';
202
+		$args[ 'offset' ]              = $request[ 'offset' ];
203
+		$args[ 'order' ]               = $request[ 'order' ];
204
+		$args[ 'orderby' ]             = $request[ 'orderby' ];
205
+		$args[ 'paged' ]               = $request[ 'page' ];
206
+		$args[ 'post__in' ]            = $request[ 'include' ];
207
+		$args[ 'post__not_in' ]        = $request[ 'exclude' ];
208
+		$args[ 'posts_per_page' ]      = $request[ 'per_page' ];
209
+		$args[ 'name' ]                = $request[ 'slug' ];
210
+		$args[ 'post_parent__in' ]     = $request[ 'parent' ];
211
+		$args[ 'post_parent__not_in' ] = $request[ 'parent_exclude' ];
212
+		$args[ 's' ]                   = $request[ 'search' ];
213
+		$args[ 'fields' ]              = 'ids';
214
+
215
+		if ( 'date' === $args[ 'orderby' ] ) {
216
+			$args[ 'orderby' ] = 'date ID';
217 217
 		}
218 218
 
219
-		$args['date_query'] = array();
219
+		$args[ 'date_query' ] = array();
220 220
 
221 221
 		// Set before into date query. Date query must be specified as an array of an array.
222
-		if ( isset( $request['before'] ) ) {
223
-			$args['date_query'][0]['before'] = $request['before'];
222
+		if ( isset( $request[ 'before' ] ) ) {
223
+			$args[ 'date_query' ][ 0 ][ 'before' ] = $request[ 'before' ];
224 224
 		}
225 225
 
226 226
 		// Set after into date query. Date query must be specified as an array of an array.
227
-		if ( isset( $request['after'] ) ) {
228
-			$args['date_query'][0]['after'] = $request['after'];
227
+		if ( isset( $request[ 'after' ] ) ) {
228
+			$args[ 'date_query' ][ 0 ][ 'after' ] = $request[ 'after' ];
229 229
 		}
230 230
 
231 231
 		// Set date query colummn. Defaults to post_date.
232
-		if ( isset( $request['date_column'] ) && ! empty( $args['date_query'][0] ) ) {
233
-			$args['date_query'][0]['column'] = 'post_' . $request['date_column'];
232
+		if ( isset( $request[ 'date_column' ] ) && ! empty( $args[ 'date_query' ][ 0 ] ) ) {
233
+			$args[ 'date_query' ][ 0 ][ 'column' ] = 'post_' . $request[ 'date_column' ];
234 234
 		}
235 235
 
236 236
 		// Force the post_type argument, since it's not a user input variable.
237
-		$args['post_type'] = $this->post_type;
237
+		$args[ 'post_type' ] = $this->post_type;
238 238
 
239 239
 		/**
240 240
 		 * Filter the query arguments for a request.
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 		$total_posts = $query->found_posts;
265 265
 		if ( $total_posts < 1 ) {
266 266
 			// Out-of-bounds, run the query again without LIMIT for total count.
267
-			unset( $query_args['paged'] );
267
+			unset( $query_args[ 'paged' ] );
268 268
 			$count_query = new \WP_Query();
269 269
 			$count_query->query( $query_args );
270 270
 			$total_posts = $count_query->found_posts;
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 		return array(
274 274
 			'objects' => array_map( array( $this, 'get_object' ), $result ),
275 275
 			'total'   => (int) $total_posts,
276
-			'pages'   => (int) ceil( $total_posts / (int) $query->query_vars['posts_per_page'] ),
276
+			'pages'   => (int) ceil( $total_posts / (int) $query->query_vars[ 'posts_per_page' ] ),
277 277
 		);
278 278
 	}
279 279
 
@@ -288,17 +288,17 @@  discard block
 block discarded – undo
288 288
 		$query_results = $this->get_objects( $query_args );
289 289
 
290 290
 		$objects = array();
291
-		foreach ( $query_results['objects'] as $object ) {
291
+		foreach ( $query_results[ 'objects' ] as $object ) {
292 292
 			if ( ! Permissions::user_can_read( $this->post_type, $object->get_id() ) ) {
293 293
 				continue;
294 294
 			}
295 295
 
296 296
 			$data      = $this->prepare_item_for_response( $object, $request );
297
-			$objects[] = $this->prepare_response_for_collection( $data );
297
+			$objects[ ] = $this->prepare_response_for_collection( $data );
298 298
 		}
299 299
 
300
-		$total     = $query_results['total'];
301
-		$max_pages = $query_results['pages'];
300
+		$total     = $query_results[ 'total' ];
301
+		$max_pages = $query_results[ 'pages' ];
302 302
 
303 303
 		$response = rest_ensure_response( $objects );
304 304
 		$response = Pagination::add_pagination_headers( $response, $request, $total, $max_pages );
@@ -313,8 +313,8 @@  discard block
 block discarded – undo
313 313
 	 * @return \WP_REST_Response|\WP_Error
314 314
 	 */
315 315
 	public function delete_item( $request ) {
316
-		$force  = (bool) $request['force'];
317
-		$object = $this->get_object( (int) $request['id'] );
316
+		$force  = (bool) $request[ 'force' ];
317
+		$object = $this->get_object( (int) $request[ 'id' ] );
318 318
 		$result = false;
319 319
 
320 320
 		if ( ! $object || 0 === $object->get_id() ) {
@@ -424,10 +424,10 @@  discard block
 block discarded – undo
424 424
 	 */
425 425
 	public function get_collection_params() {
426 426
 		$params                       = array();
427
-		$params['context']            = $this->get_context_param();
428
-		$params['context']['default'] = 'view';
427
+		$params[ 'context' ]            = $this->get_context_param();
428
+		$params[ 'context' ][ 'default' ] = 'view';
429 429
 
430
-		$params['page'] = array(
430
+		$params[ 'page' ] = array(
431 431
 			'description'       => __( 'Current page of the collection.', 'woocommerce' ),
432 432
 			'type'              => 'integer',
433 433
 			'default'           => 1,
@@ -436,7 +436,7 @@  discard block
 block discarded – undo
436 436
 			'minimum'           => 1,
437 437
 		);
438 438
 
439
-		$params['per_page'] = array(
439
+		$params[ 'per_page' ] = array(
440 440
 			'description'       => __( 'Maximum number of items to be returned in result set.', 'woocommerce' ),
441 441
 			'type'              => 'integer',
442 442
 			'default'           => 10,
@@ -446,28 +446,28 @@  discard block
 block discarded – undo
446 446
 			'validate_callback' => 'rest_validate_request_arg',
447 447
 		);
448 448
 
449
-		$params['search'] = array(
449
+		$params[ 'search' ] = array(
450 450
 			'description'       => __( 'Limit results to those matching a string.', 'woocommerce' ),
451 451
 			'type'              => 'string',
452 452
 			'sanitize_callback' => 'sanitize_text_field',
453 453
 			'validate_callback' => 'rest_validate_request_arg',
454 454
 		);
455 455
 
456
-		$params['after'] = array(
456
+		$params[ 'after' ] = array(
457 457
 			'description'       => __( 'Limit response to resources created after a given ISO8601 compliant date.', 'woocommerce' ),
458 458
 			'type'              => 'string',
459 459
 			'format'            => 'date-time',
460 460
 			'validate_callback' => 'rest_validate_request_arg',
461 461
 		);
462 462
 
463
-		$params['before'] = array(
463
+		$params[ 'before' ] = array(
464 464
 			'description'       => __( 'Limit response to resources created before a given ISO8601 compliant date.', 'woocommerce' ),
465 465
 			'type'              => 'string',
466 466
 			'format'            => 'date-time',
467 467
 			'validate_callback' => 'rest_validate_request_arg',
468 468
 		);
469 469
 
470
-		$params['date_column'] = array(
470
+		$params[ 'date_column' ] = array(
471 471
 			'description'       => __( 'When limiting response using after/before, which date column to compare against.', 'woocommerce' ),
472 472
 			'type'              => 'string',
473 473
 			'default'           => 'date',
@@ -480,14 +480,14 @@  discard block
 block discarded – undo
480 480
 			'validate_callback' => 'rest_validate_request_arg',
481 481
 		);
482 482
 
483
-		$params['modified_before'] = array(
483
+		$params[ 'modified_before' ] = array(
484 484
 			'description'       => __( 'Limit response to resources modified before a given ISO8601 compliant date.', 'woocommerce' ),
485 485
 			'type'              => 'string',
486 486
 			'format'            => 'date-time',
487 487
 			'validate_callback' => 'rest_validate_request_arg',
488 488
 		);
489 489
 
490
-		$params['exclude'] = array(
490
+		$params[ 'exclude' ] = array(
491 491
 			'description'       => __( 'Ensure result set excludes specific IDs.', 'woocommerce' ),
492 492
 			'type'              => 'array',
493 493
 			'items'             => array(
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
 			'sanitize_callback' => 'wp_parse_id_list',
498 498
 		);
499 499
 
500
-		$params['include'] = array(
500
+		$params[ 'include' ] = array(
501 501
 			'description'       => __( 'Limit result set to specific ids.', 'woocommerce' ),
502 502
 			'type'              => 'array',
503 503
 			'items'             => array(
@@ -507,14 +507,14 @@  discard block
 block discarded – undo
507 507
 			'sanitize_callback' => 'wp_parse_id_list',
508 508
 		);
509 509
 
510
-		$params['offset'] = array(
510
+		$params[ 'offset' ] = array(
511 511
 			'description'       => __( 'Offset the result set by a specific number of items.', 'woocommerce' ),
512 512
 			'type'              => 'integer',
513 513
 			'sanitize_callback' => 'absint',
514 514
 			'validate_callback' => 'rest_validate_request_arg',
515 515
 		);
516 516
 
517
-		$params['order'] = array(
517
+		$params[ 'order' ] = array(
518 518
 			'description'       => __( 'Order sort attribute ascending or descending.', 'woocommerce' ),
519 519
 			'type'              => 'string',
520 520
 			'default'           => 'desc',
@@ -522,7 +522,7 @@  discard block
 block discarded – undo
522 522
 			'validate_callback' => 'rest_validate_request_arg',
523 523
 		);
524 524
 
525
-		$params['orderby'] = array(
525
+		$params[ 'orderby' ] = array(
526 526
 			'description'       => __( 'Sort collection by object attribute.', 'woocommerce' ),
527 527
 			'type'              => 'string',
528 528
 			'default'           => 'date',
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
 		);
539 539
 
540 540
 		if ( $this->hierarchical ) {
541
-			$params['parent'] = array(
541
+			$params[ 'parent' ] = array(
542 542
 				'description'       => __( 'Limit result set to those of particular parent IDs.', 'woocommerce' ),
543 543
 				'type'              => 'array',
544 544
 				'items'             => array(
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
 				'default'           => array(),
549 549
 			);
550 550
 
551
-			$params['parent_exclude'] = array(
551
+			$params[ 'parent_exclude' ] = array(
552 552
 				'description'       => __( 'Limit result set to all items except those of a particular parent ID.', 'woocommerce' ),
553 553
 				'type'              => 'array',
554 554
 				'items'             => array(
@@ -599,14 +599,14 @@  discard block
 block discarded – undo
599 599
 			}
600 600
 		}
601 601
 
602
-		$query_args['ignore_sticky_posts'] = true;
602
+		$query_args[ 'ignore_sticky_posts' ] = true;
603 603
 
604
-		if ( 'include' === $query_args['orderby'] ) {
605
-			$query_args['orderby'] = 'post__in';
606
-		} elseif ( 'id' === $query_args['orderby'] ) {
607
-			$query_args['orderby'] = 'ID'; // ID must be capitalized.
608
-		} elseif ( 'slug' === $query_args['orderby'] ) {
609
-			$query_args['orderby'] = 'name';
604
+		if ( 'include' === $query_args[ 'orderby' ] ) {
605
+			$query_args[ 'orderby' ] = 'post__in';
606
+		} elseif ( 'id' === $query_args[ 'orderby' ] ) {
607
+			$query_args[ 'orderby' ] = 'ID'; // ID must be capitalized.
608
+		} elseif ( 'slug' === $query_args[ 'orderby' ] ) {
609
+			$query_args[ 'orderby' ] = 'name';
610 610
 		}
611 611
 
612 612
 		return $query_args;
@@ -694,13 +694,13 @@  discard block
 block discarded – undo
694 694
 	 * @return array
695 695
 	 */
696 696
 	protected function add_meta_query( $args, $meta_query ) {
697
-		if ( empty( $args['meta_query'] ) ) {
698
-			$args['meta_query'] = []; // phpcs:ignore
697
+		if ( empty( $args[ 'meta_query' ] ) ) {
698
+			$args[ 'meta_query' ] = [ ]; // phpcs:ignore
699 699
 		}
700 700
 
701
-		$args['meta_query'][] = $meta_query;
701
+		$args[ 'meta_query' ][ ] = $meta_query;
702 702
 
703
-		return $args['meta_query'];
703
+		return $args[ 'meta_query' ];
704 704
 	}
705 705
 
706 706
 	/**
Please login to merge, or discard this patch.
src/Controllers/Version4/AbstractTermsContoller.php 1 patch
Spacing   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -132,32 +132,32 @@  discard block
 block discarded – undo
132 132
 	public function get_items( $request ) {
133 133
 		$taxonomy      = $this->get_taxonomy( $request );
134 134
 		$prepared_args = array(
135
-			'exclude'    => $request['exclude'],
136
-			'include'    => $request['include'],
137
-			'order'      => $request['order'],
138
-			'orderby'    => $request['orderby'],
139
-			'product'    => $request['product'],
140
-			'hide_empty' => $request['hide_empty'],
141
-			'number'     => $request['per_page'],
142
-			'search'     => $request['search'],
143
-			'slug'       => $request['slug'],
135
+			'exclude'    => $request[ 'exclude' ],
136
+			'include'    => $request[ 'include' ],
137
+			'order'      => $request[ 'order' ],
138
+			'orderby'    => $request[ 'orderby' ],
139
+			'product'    => $request[ 'product' ],
140
+			'hide_empty' => $request[ 'hide_empty' ],
141
+			'number'     => $request[ 'per_page' ],
142
+			'search'     => $request[ 'search' ],
143
+			'slug'       => $request[ 'slug' ],
144 144
 		);
145 145
 
146
-		if ( ! empty( $request['offset'] ) ) {
147
-			$prepared_args['offset'] = $request['offset'];
146
+		if ( ! empty( $request[ 'offset' ] ) ) {
147
+			$prepared_args[ 'offset' ] = $request[ 'offset' ];
148 148
 		} else {
149
-			$prepared_args['offset'] = ( $request['page'] - 1 ) * $prepared_args['number'];
149
+			$prepared_args[ 'offset' ] = ( $request[ 'page' ] - 1 ) * $prepared_args[ 'number' ];
150 150
 		}
151 151
 
152 152
 		$taxonomy_obj = get_taxonomy( $taxonomy );
153 153
 
154
-		if ( $taxonomy_obj->hierarchical && isset( $request['parent'] ) ) {
155
-			if ( 0 === $request['parent'] ) {
154
+		if ( $taxonomy_obj->hierarchical && isset( $request[ 'parent' ] ) ) {
155
+			if ( 0 === $request[ 'parent' ] ) {
156 156
 				// Only query top-level terms.
157
-				$prepared_args['parent'] = 0;
157
+				$prepared_args[ 'parent' ] = 0;
158 158
 			} else {
159
-				if ( $request['parent'] ) {
160
-					$prepared_args['parent'] = $request['parent'];
159
+				if ( $request[ 'parent' ] ) {
160
+					$prepared_args[ 'parent' ] = $request[ 'parent' ];
161 161
 				}
162 162
 			}
163 163
 		}
@@ -176,20 +176,20 @@  discard block
 block discarded – undo
176 176
 		 */
177 177
 		$prepared_args = apply_filters( "woocommerce_rest_{$taxonomy}_query", $prepared_args, $request );
178 178
 
179
-		if ( ! empty( $prepared_args['product'] ) ) {
179
+		if ( ! empty( $prepared_args[ 'product' ] ) ) {
180 180
 			$query_result = $this->get_terms_for_product( $prepared_args, $request );
181 181
 			$total_terms  = $this->total_terms;
182 182
 		} else {
183 183
 			$query_result = get_terms( $taxonomy, $prepared_args );
184 184
 
185 185
 			$count_args = $prepared_args;
186
-			unset( $count_args['number'] );
187
-			unset( $count_args['offset'] );
186
+			unset( $count_args[ 'number' ] );
187
+			unset( $count_args[ 'offset' ] );
188 188
 			$total_terms = wp_count_terms( $taxonomy, $count_args );
189 189
 
190 190
 			// Ensure we don't return results when offset is out of bounds.
191 191
 			// See https://core.trac.wordpress.org/ticket/35935.
192
-			if ( $prepared_args['offset'] && $prepared_args['offset'] >= $total_terms ) {
192
+			if ( $prepared_args[ 'offset' ] && $prepared_args[ 'offset' ] >= $total_terms ) {
193 193
 				$query_result = array();
194 194
 			}
195 195
 
@@ -201,11 +201,11 @@  discard block
 block discarded – undo
201 201
 		$response = array();
202 202
 		foreach ( $query_result as $term ) {
203 203
 			$data       = $this->prepare_item_for_response( $term, $request );
204
-			$response[] = $this->prepare_response_for_collection( $data );
204
+			$response[ ] = $this->prepare_response_for_collection( $data );
205 205
 		}
206 206
 
207 207
 		// Store pagination values for headers then unset for count query.
208
-		$per_page  = (int) $prepared_args['number'];
208
+		$per_page  = (int) $prepared_args[ 'number' ];
209 209
 		$max_pages = ceil( $total_terms / $per_page );
210 210
 
211 211
 		$response = rest_ensure_response( $response );
@@ -222,21 +222,21 @@  discard block
 block discarded – undo
222 222
 	 */
223 223
 	public function create_item( $request ) {
224 224
 		$taxonomy = $this->get_taxonomy( $request );
225
-		$name     = $request['name'];
225
+		$name     = $request[ 'name' ];
226 226
 		$args     = array();
227 227
 		$schema   = $this->get_item_schema();
228 228
 
229
-		if ( ! empty( $schema['properties']['description'] ) && isset( $request['description'] ) ) {
230
-			$args['description'] = $request['description'];
229
+		if ( ! empty( $schema[ 'properties' ][ 'description' ] ) && isset( $request[ 'description' ] ) ) {
230
+			$args[ 'description' ] = $request[ 'description' ];
231 231
 		}
232
-		if ( isset( $request['slug'] ) ) {
233
-			$args['slug'] = $request['slug'];
232
+		if ( isset( $request[ 'slug' ] ) ) {
233
+			$args[ 'slug' ] = $request[ 'slug' ];
234 234
 		}
235
-		if ( isset( $request['parent'] ) ) {
235
+		if ( isset( $request[ 'parent' ] ) ) {
236 236
 			if ( ! is_taxonomy_hierarchical( $taxonomy ) ) {
237 237
 				return new \WP_Error( 'woocommerce_rest_taxonomy_not_hierarchical', __( 'Can not set resource parent, taxonomy is not hierarchical.', 'woocommerce' ), array( 'status' => 400 ) );
238 238
 			}
239
-			$args['parent'] = $request['parent'];
239
+			$args[ 'parent' ] = $request[ 'parent' ];
240 240
 		}
241 241
 
242 242
 		$term = wp_insert_term( $name, $taxonomy, $args );
@@ -247,13 +247,13 @@  discard block
 block discarded – undo
247 247
 			// give them the identifier they can actually use.
248 248
 			$term_id = $term->get_error_data( 'term_exists' );
249 249
 			if ( $term_id ) {
250
-				$error_data['resource_id'] = $term_id;
250
+				$error_data[ 'resource_id' ] = $term_id;
251 251
 			}
252 252
 
253 253
 			return new \WP_Error( $term->get_error_code(), $term->get_error_message(), $error_data );
254 254
 		}
255 255
 
256
-		$term = get_term( $term['term_id'], $taxonomy );
256
+		$term = get_term( $term[ 'term_id' ], $taxonomy );
257 257
 
258 258
 		$this->update_additional_fields_for_object( $term, $request );
259 259
 
@@ -280,8 +280,8 @@  discard block
 block discarded – undo
280 280
 		$response->set_status( 201 );
281 281
 
282 282
 		$base = '/' . $this->namespace . '/' . $this->rest_base;
283
-		if ( ! empty( $request['attribute_id'] ) ) {
284
-			$base = str_replace( '(?P<attribute_id>[\d]+)', (int) $request['attribute_id'], $base );
283
+		if ( ! empty( $request[ 'attribute_id' ] ) ) {
284
+			$base = str_replace( '(?P<attribute_id>[\d]+)', (int) $request[ 'attribute_id' ], $base );
285 285
 		}
286 286
 
287 287
 		$response->header( 'Location', rest_url( $base . '/' . $term->term_id ) );
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 	 */
298 298
 	public function get_item( $request ) {
299 299
 		$taxonomy = $this->get_taxonomy( $request );
300
-		$term     = get_term( (int) $request['id'], $taxonomy );
300
+		$term     = get_term( (int) $request[ 'id' ], $taxonomy );
301 301
 
302 302
 		if ( is_wp_error( $term ) ) {
303 303
 			return $term;
@@ -316,24 +316,24 @@  discard block
 block discarded – undo
316 316
 	 */
317 317
 	public function update_item( $request ) {
318 318
 		$taxonomy      = $this->get_taxonomy( $request );
319
-		$term          = get_term( (int) $request['id'], $taxonomy );
319
+		$term          = get_term( (int) $request[ 'id' ], $taxonomy );
320 320
 		$schema        = $this->get_item_schema();
321 321
 		$prepared_args = array();
322 322
 
323
-		if ( isset( $request['name'] ) ) {
324
-			$prepared_args['name'] = $request['name'];
323
+		if ( isset( $request[ 'name' ] ) ) {
324
+			$prepared_args[ 'name' ] = $request[ 'name' ];
325 325
 		}
326
-		if ( ! empty( $schema['properties']['description'] ) && isset( $request['description'] ) ) {
327
-			$prepared_args['description'] = $request['description'];
326
+		if ( ! empty( $schema[ 'properties' ][ 'description' ] ) && isset( $request[ 'description' ] ) ) {
327
+			$prepared_args[ 'description' ] = $request[ 'description' ];
328 328
 		}
329
-		if ( isset( $request['slug'] ) ) {
330
-			$prepared_args['slug'] = $request['slug'];
329
+		if ( isset( $request[ 'slug' ] ) ) {
330
+			$prepared_args[ 'slug' ] = $request[ 'slug' ];
331 331
 		}
332
-		if ( isset( $request['parent'] ) ) {
332
+		if ( isset( $request[ 'parent' ] ) ) {
333 333
 			if ( ! is_taxonomy_hierarchical( $taxonomy ) ) {
334 334
 				return new \WP_Error( 'woocommerce_rest_taxonomy_not_hierarchical', __( 'Can not set resource parent, taxonomy is not hierarchical.', 'woocommerce' ), array( 'status' => 400 ) );
335 335
 			}
336
-			$prepared_args['parent'] = $request['parent'];
336
+			$prepared_args[ 'parent' ] = $request[ 'parent' ];
337 337
 		}
338 338
 
339 339
 		// Only update the term if we haz something to update.
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
 			}
345 345
 		}
346 346
 
347
-		$term = get_term( (int) $request['id'], $taxonomy );
347
+		$term = get_term( (int) $request[ 'id' ], $taxonomy );
348 348
 
349 349
 		$this->update_additional_fields_for_object( $term, $request );
350 350
 
@@ -376,19 +376,19 @@  discard block
 block discarded – undo
376 376
 	 */
377 377
 	public function delete_item( $request ) {
378 378
 		$taxonomy = $this->get_taxonomy( $request );
379
-		$force    = isset( $request['force'] ) ? (bool) $request['force'] : false;
379
+		$force    = isset( $request[ 'force' ] ) ? (bool) $request[ 'force' ] : false;
380 380
 
381 381
 		// We don't support trashing for this type, error out.
382 382
 		if ( ! $force ) {
383 383
 			return new \WP_Error( 'woocommerce_rest_trash_not_supported', __( 'Resource does not support trashing.', 'woocommerce' ), array( 'status' => 501 ) );
384 384
 		}
385 385
 
386
-		$term = get_term( (int) $request['id'], $taxonomy );
386
+		$term = get_term( (int) $request[ 'id' ], $taxonomy );
387 387
 		// Get default category id.
388 388
 		$default_category_id = absint( get_option( 'default_product_cat', 0 ) );
389 389
 
390 390
 		// Prevent deleting the default product category.
391
-		if ( $default_category_id === (int) $request['id'] ) {
391
+		if ( $default_category_id === (int) $request[ 'id' ] ) {
392 392
 			return new \WP_Error( 'woocommerce_rest_cannot_delete', __( 'Default product category cannot be deleted.', 'woocommerce' ), array( 'status' => 500 ) );
393 393
 		}
394 394
 
@@ -422,8 +422,8 @@  discard block
 block discarded – undo
422 422
 	protected function prepare_links( $item, $request ) {
423 423
 		$base = '/' . $this->namespace . '/' . $this->rest_base;
424 424
 
425
-		if ( ! empty( $request['attribute_id'] ) ) {
426
-			$base = str_replace( '(?P<attribute_id>[\d]+)', (int) $request['attribute_id'], $base );
425
+		if ( ! empty( $request[ 'attribute_id' ] ) ) {
426
+			$base = str_replace( '(?P<attribute_id>[\d]+)', (int) $request[ 'attribute_id' ], $base );
427 427
 		}
428 428
 
429 429
 		$links = array(
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 		if ( $item->parent ) {
439 439
 			$parent_term = get_term( (int) $item->parent, $item->taxonomy );
440 440
 			if ( $parent_term ) {
441
-				$links['up'] = array(
441
+				$links[ 'up' ] = array(
442 442
 					'href' => rest_url( trailingslashit( $base ) . $parent_term->term_id ),
443 443
 				);
444 444
 			}
@@ -473,7 +473,7 @@  discard block
 block discarded – undo
473 473
 	protected function get_terms_for_product( $prepared_args, $request ) {
474 474
 		$taxonomy = $this->get_taxonomy( $request );
475 475
 
476
-		$query_result = get_the_terms( $prepared_args['product'], $taxonomy );
476
+		$query_result = get_the_terms( $prepared_args[ 'product' ], $taxonomy );
477 477
 		if ( empty( $query_result ) ) {
478 478
 			$this->total_terms = 0;
479 479
 			return array();
@@ -481,8 +481,8 @@  discard block
 block discarded – undo
481 481
 
482 482
 		// get_items() verifies that we don't have `include` set, and default.
483 483
 		// ordering is by `name`.
484
-		if ( ! in_array( $prepared_args['orderby'], array( 'name', 'none', 'include' ), true ) ) {
485
-			switch ( $prepared_args['orderby'] ) {
484
+		if ( ! in_array( $prepared_args[ 'orderby' ], array( 'name', 'none', 'include' ), true ) ) {
485
+			switch ( $prepared_args[ 'orderby' ] ) {
486 486
 				case 'id':
487 487
 					$this->sort_column = 'term_id';
488 488
 					break;
@@ -490,18 +490,18 @@  discard block
 block discarded – undo
490 490
 				case 'term_group':
491 491
 				case 'description':
492 492
 				case 'count':
493
-					$this->sort_column = $prepared_args['orderby'];
493
+					$this->sort_column = $prepared_args[ 'orderby' ];
494 494
 					break;
495 495
 			}
496 496
 			usort( $query_result, array( $this, 'compare_terms' ) );
497 497
 		}
498
-		if ( strtolower( $prepared_args['order'] ) !== 'asc' ) {
498
+		if ( strtolower( $prepared_args[ 'order' ] ) !== 'asc' ) {
499 499
 			$query_result = array_reverse( $query_result );
500 500
 		}
501 501
 
502 502
 		// Pagination.
503 503
 		$this->total_terms = count( $query_result );
504
-		$query_result      = array_slice( $query_result, $prepared_args['offset'], $prepared_args['number'] );
504
+		$query_result      = array_slice( $query_result, $prepared_args[ 'offset' ], $prepared_args[ 'number' ] );
505 505
 
506 506
 		return $query_result;
507 507
 	}
@@ -542,9 +542,9 @@  discard block
 block discarded – undo
542 542
 			$taxonomy->hierarchical = true;
543 543
 		}
544 544
 
545
-		$params['context']['default'] = 'view';
545
+		$params[ 'context' ][ 'default' ] = 'view';
546 546
 
547
-		$params['exclude'] = array(
547
+		$params[ 'exclude' ] = array(
548 548
 			'description'       => __( 'Ensure result set excludes specific IDs.', 'woocommerce' ),
549 549
 			'type'              => 'array',
550 550
 			'items'             => array(
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
 			'default'           => array(),
554 554
 			'sanitize_callback' => 'wp_parse_id_list',
555 555
 		);
556
-		$params['include'] = array(
556
+		$params[ 'include' ] = array(
557 557
 			'description'       => __( 'Limit result set to specific ids.', 'woocommerce' ),
558 558
 			'type'              => 'array',
559 559
 			'items'             => array(
@@ -563,14 +563,14 @@  discard block
 block discarded – undo
563 563
 			'sanitize_callback' => 'wp_parse_id_list',
564 564
 		);
565 565
 		if ( ! $taxonomy->hierarchical ) {
566
-			$params['offset'] = array(
566
+			$params[ 'offset' ] = array(
567 567
 				'description'       => __( 'Offset the result set by a specific number of items.', 'woocommerce' ),
568 568
 				'type'              => 'integer',
569 569
 				'sanitize_callback' => 'absint',
570 570
 				'validate_callback' => 'rest_validate_request_arg',
571 571
 			);
572 572
 		}
573
-		$params['order']      = array(
573
+		$params[ 'order' ] = array(
574 574
 			'description'       => __( 'Order sort attribute ascending or descending.', 'woocommerce' ),
575 575
 			'type'              => 'string',
576 576
 			'sanitize_callback' => 'sanitize_key',
@@ -581,7 +581,7 @@  discard block
 block discarded – undo
581 581
 			),
582 582
 			'validate_callback' => 'rest_validate_request_arg',
583 583
 		);
584
-		$params['orderby']    = array(
584
+		$params[ 'orderby' ] = array(
585 585
 			'description'       => __( 'Sort collection by resource attribute.', 'woocommerce' ),
586 586
 			'type'              => 'string',
587 587
 			'sanitize_callback' => 'sanitize_key',
@@ -597,27 +597,27 @@  discard block
 block discarded – undo
597 597
 			),
598 598
 			'validate_callback' => 'rest_validate_request_arg',
599 599
 		);
600
-		$params['hide_empty'] = array(
600
+		$params[ 'hide_empty' ] = array(
601 601
 			'description'       => __( 'Whether to hide resources not assigned to any products.', 'woocommerce' ),
602 602
 			'type'              => 'boolean',
603 603
 			'default'           => false,
604 604
 			'validate_callback' => 'rest_validate_request_arg',
605 605
 		);
606 606
 		if ( $taxonomy->hierarchical ) {
607
-			$params['parent'] = array(
607
+			$params[ 'parent' ] = array(
608 608
 				'description'       => __( 'Limit result set to resources assigned to a specific parent.', 'woocommerce' ),
609 609
 				'type'              => 'integer',
610 610
 				'sanitize_callback' => 'absint',
611 611
 				'validate_callback' => 'rest_validate_request_arg',
612 612
 			);
613 613
 		}
614
-		$params['product'] = array(
614
+		$params[ 'product' ] = array(
615 615
 			'description'       => __( 'Limit result set to resources assigned to a specific product.', 'woocommerce' ),
616 616
 			'type'              => 'integer',
617 617
 			'default'           => null,
618 618
 			'validate_callback' => 'rest_validate_request_arg',
619 619
 		);
620
-		$params['slug']    = array(
620
+		$params[ 'slug' ] = array(
621 621
 			'description'       => __( 'Limit result set to resources with a specific slug.', 'woocommerce' ),
622 622
 			'type'              => 'string',
623 623
 			'validate_callback' => 'rest_validate_request_arg',
@@ -639,8 +639,8 @@  discard block
 block discarded – undo
639 639
 			return $this->taxonomy;
640 640
 		}
641 641
 
642
-		if ( ! empty( $request['attribute_id'] ) ) {
643
-			$taxonomy = wc_attribute_taxonomy_name_by_id( (int) $request['attribute_id'] );
642
+		if ( ! empty( $request[ 'attribute_id' ] ) ) {
643
+			$taxonomy = wc_attribute_taxonomy_name_by_id( (int) $request[ 'attribute_id' ] );
644 644
 
645 645
 			$this->taxonomy = $taxonomy;
646 646
 		}
Please login to merge, or discard this patch.
src/Controllers/Version4/OrderRefunds.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	 * @return array Array of data in the correct format.
130 130
 	 */
131 131
 	protected function get_data_for_response( $object, $request ) {
132
-		$order = wc_get_order( (int) $request['order_id'] );
132
+		$order = wc_get_order( (int) $request[ 'order_id' ] );
133 133
 
134 134
 		if ( ! $order ) {
135 135
 			throw new \WC_REST_Exception( 'woocommerce_rest_invalid_order_id', __( 'Invalid order ID.', 'woocommerce' ), 404 );
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 		$format_decimal    = array( 'amount' );
144 144
 		$format_date       = array( 'date_created' );
145 145
 		$format_line_items = array( 'line_items' );
146
-		$dp                = is_null( $request['dp'] ) ? wc_get_price_decimals() : absint( $request['dp'] );
146
+		$dp                = is_null( $request[ 'dp' ] ) ? wc_get_price_decimals() : absint( $request[ 'dp' ] );
147 147
 
148 148
 		// Format decimal values.
149 149
 		foreach ( $format_decimal as $key ) {
@@ -164,14 +164,14 @@  discard block
 block discarded – undo
164 164
 
165 165
 		return array(
166 166
 			'id'               => $object->get_id(),
167
-			'date_created'     => $data['date_created'],
168
-			'date_created_gmt' => $data['date_created_gmt'],
169
-			'amount'           => $data['amount'],
170
-			'reason'           => $data['reason'],
171
-			'refunded_by'      => $data['refunded_by'],
172
-			'refunded_payment' => $data['refunded_payment'],
173
-			'meta_data'        => $data['meta_data'],
174
-			'line_items'       => $data['line_items'],
167
+			'date_created'     => $data[ 'date_created' ],
168
+			'date_created_gmt' => $data[ 'date_created_gmt' ],
169
+			'amount'           => $data[ 'amount' ],
170
+			'reason'           => $data[ 'reason' ],
171
+			'refunded_by'      => $data[ 'refunded_by' ],
172
+			'refunded_payment' => $data[ 'refunded_payment' ],
173
+			'meta_data'        => $data[ 'meta_data' ],
174
+			'line_items'       => $data[ 'line_items' ],
175 175
 		);
176 176
 	}
177 177
 
@@ -185,45 +185,45 @@  discard block
 block discarded – undo
185 185
 	protected function get_order_item_data( $item, $request ) {
186 186
 		$data           = $item->get_data();
187 187
 		$format_decimal = array( 'subtotal', 'subtotal_tax', 'total', 'total_tax', 'tax_total', 'shipping_tax_total' );
188
-		$dp             = is_null( $request['dp'] ) ? wc_get_price_decimals() : absint( $request['dp'] );
188
+		$dp             = is_null( $request[ 'dp' ] ) ? wc_get_price_decimals() : absint( $request[ 'dp' ] );
189 189
 
190 190
 		// Format decimal values.
191 191
 		foreach ( $format_decimal as $key ) {
192 192
 			if ( isset( $data[ $key ] ) ) {
193
-				$data[ $key ] = wc_format_decimal( $data[ $key ], $this->request['dp'] );
193
+				$data[ $key ] = wc_format_decimal( $data[ $key ], $this->request[ 'dp' ] );
194 194
 			}
195 195
 		}
196 196
 
197 197
 		// Add SKU and PRICE to products.
198 198
 		if ( is_callable( array( $item, 'get_product' ) ) ) {
199
-			$data['sku']   = $item->get_product() ? $item->get_product()->get_sku() : null;
200
-			$data['price'] = $item->get_quantity() ? $item->get_total() / $item->get_quantity() : 0;
199
+			$data[ 'sku' ]   = $item->get_product() ? $item->get_product()->get_sku() : null;
200
+			$data[ 'price' ] = $item->get_quantity() ? $item->get_total() / $item->get_quantity() : 0;
201 201
 		}
202 202
 
203 203
 		// Format taxes.
204
-		if ( ! empty( $data['taxes']['total'] ) ) {
204
+		if ( ! empty( $data[ 'taxes' ][ 'total' ] ) ) {
205 205
 			$taxes = array();
206 206
 
207
-			foreach ( $data['taxes']['total'] as $tax_rate_id => $tax ) {
208
-				$taxes[] = array(
207
+			foreach ( $data[ 'taxes' ][ 'total' ] as $tax_rate_id => $tax ) {
208
+				$taxes[ ] = array(
209 209
 					'id'       => $tax_rate_id,
210 210
 					'total'    => $tax,
211
-					'subtotal' => isset( $data['taxes']['subtotal'][ $tax_rate_id ] ) ? $data['taxes']['subtotal'][ $tax_rate_id ] : '',
211
+					'subtotal' => isset( $data[ 'taxes' ][ 'subtotal' ][ $tax_rate_id ] ) ? $data[ 'taxes' ][ 'subtotal' ][ $tax_rate_id ] : '',
212 212
 				);
213 213
 			}
214
-			$data['taxes'] = $taxes;
215
-		} elseif ( isset( $data['taxes'] ) ) {
216
-			$data['taxes'] = array();
214
+			$data[ 'taxes' ] = $taxes;
215
+		} elseif ( isset( $data[ 'taxes' ] ) ) {
216
+			$data[ 'taxes' ] = array();
217 217
 		}
218 218
 
219 219
 		// Remove names for coupons, taxes and shipping.
220
-		if ( isset( $data['code'] ) || isset( $data['rate_code'] ) || isset( $data['method_title'] ) ) {
221
-			unset( $data['name'] );
220
+		if ( isset( $data[ 'code' ] ) || isset( $data[ 'rate_code' ] ) || isset( $data[ 'method_title' ] ) ) {
221
+			unset( $data[ 'name' ] );
222 222
 		}
223 223
 
224 224
 		// Remove props we don't want to expose.
225
-		unset( $data['order_id'] );
226
-		unset( $data['type'] );
225
+		unset( $data[ 'order_id' ] );
226
+		unset( $data[ 'type' ] );
227 227
 
228 228
 		return $data;
229 229
 	}
@@ -262,8 +262,8 @@  discard block
 block discarded – undo
262 262
 	protected function prepare_objects_query( $request ) {
263 263
 		$args = parent::prepare_objects_query( $request );
264 264
 
265
-		$args['post_status']     = array_keys( wc_get_order_statuses() );
266
-		$args['post_parent__in'] = array( absint( $request['order_id'] ) );
265
+		$args[ 'post_status' ]     = array_keys( wc_get_order_statuses() );
266
+		$args[ 'post_parent__in' ] = array( absint( $request[ 'order_id' ] ) );
267 267
 
268 268
 		return $args;
269 269
 	}
@@ -275,18 +275,18 @@  discard block
 block discarded – undo
275 275
 	 * @return \WP_Error|\WP_REST_Response
276 276
 	 */
277 277
 	public function create_item( $request ) {
278
-		if ( ! empty( $request['id'] ) ) {
278
+		if ( ! empty( $request[ 'id' ] ) ) {
279 279
 			/* translators: %s: post type */
280 280
 			return new \WP_Error( "woocommerce_rest_{$this->post_type}_exists", sprintf( __( 'Cannot create existing %s.', 'woocommerce' ), $this->post_type ), array( 'status' => 400 ) );
281 281
 		}
282 282
 
283
-		$order_data = get_post( (int) $request['order_id'] );
283
+		$order_data = get_post( (int) $request[ 'order_id' ] );
284 284
 
285 285
 		if ( empty( $order_data ) ) {
286 286
 			return new \WP_Error( 'woocommerce_rest_invalid_order', __( 'Order is invalid', 'woocommerce' ), 400 );
287 287
 		}
288 288
 
289
-		if ( 0 > $request['amount'] ) {
289
+		if ( 0 > $request[ 'amount' ] ) {
290 290
 			return new \WP_Error( 'woocommerce_rest_invalid_order_refund', __( 'Refund amount must be greater than zero.', 'woocommerce' ), 400 );
291 291
 		}
292 292
 
@@ -294,9 +294,9 @@  discard block
 block discarded – undo
294 294
 		$refund = wc_create_refund(
295 295
 			array(
296 296
 				'order_id'       => $order_data->ID,
297
-				'amount'         => $request['amount'],
298
-				'reason'         => empty( $request['reason'] ) ? null : $request['reason'],
299
-				'refund_payment' => is_bool( $request['api_refund'] ) ? $request['api_refund'] : true,
297
+				'amount'         => $request[ 'amount' ],
298
+				'reason'         => empty( $request[ 'reason' ] ) ? null : $request[ 'reason' ],
299
+				'refund_payment' => is_bool( $request[ 'api_refund' ] ) ? $request[ 'api_refund' ] : true,
300 300
 				'restock_items'  => true,
301 301
 			)
302 302
 		);
@@ -339,13 +339,13 @@  discard block
 block discarded – undo
339 339
 	 * @return \WP_Error|\WC_Data The prepared item, or \WP_Error object on failure.
340 340
 	 */
341 341
 	protected function prepare_object_for_database( $request, $creating = false ) {
342
-		$order = wc_get_order( (int) $request['order_id'] );
342
+		$order = wc_get_order( (int) $request[ 'order_id' ] );
343 343
 
344 344
 		if ( ! $order ) {
345 345
 			return new \WP_Error( 'woocommerce_rest_invalid_order_id', __( 'Invalid order ID.', 'woocommerce' ), 404 );
346 346
 		}
347 347
 
348
-		if ( 0 > $request['amount'] ) {
348
+		if ( 0 > $request[ 'amount' ] ) {
349 349
 			return new \WP_Error( 'woocommerce_rest_invalid_order_refund', __( 'Refund amount must be greater than zero.', 'woocommerce' ), 400 );
350 350
 		}
351 351
 
@@ -353,10 +353,10 @@  discard block
 block discarded – undo
353 353
 		$refund = wc_create_refund(
354 354
 			array(
355 355
 				'order_id'       => $order->get_id(),
356
-				'amount'         => $request['amount'],
357
-				'reason'         => empty( $request['reason'] ) ? null : $request['reason'],
358
-				'line_items'     => empty( $request['line_items'] ) ? array() : $request['line_items'],
359
-				'refund_payment' => is_bool( $request['api_refund'] ) ? $request['api_refund'] : true,
356
+				'amount'         => $request[ 'amount' ],
357
+				'reason'         => empty( $request[ 'reason' ] ) ? null : $request[ 'reason' ],
358
+				'line_items'     => empty( $request[ 'line_items' ] ) ? array() : $request[ 'line_items' ],
359
+				'refund_payment' => is_bool( $request[ 'api_refund' ] ) ? $request[ 'api_refund' ] : true,
360 360
 				'restock_items'  => true,
361 361
 			)
362 362
 		);
@@ -369,9 +369,9 @@  discard block
 block discarded – undo
369 369
 			return new \WP_Error( 'woocommerce_rest_cannot_create_order_refund', __( 'Cannot create order refund, please try again.', 'woocommerce' ), 500 );
370 370
 		}
371 371
 
372
-		if ( ! empty( $request['meta_data'] ) && is_array( $request['meta_data'] ) ) {
373
-			foreach ( $request['meta_data'] as $meta ) {
374
-				$refund->update_meta_data( $meta['key'], $meta['value'], isset( $meta['id'] ) ? $meta['id'] : '' );
372
+		if ( ! empty( $request[ 'meta_data' ] ) && is_array( $request[ 'meta_data' ] ) ) {
373
+			foreach ( $request[ 'meta_data' ] as $meta ) {
374
+				$refund->update_meta_data( $meta[ 'key' ], $meta[ 'value' ], isset( $meta[ 'id' ] ) ? $meta[ 'id' ] : '' );
375 375
 			}
376 376
 			$refund->save_meta_data();
377 377
 		}
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
 	public function get_collection_params() {
651 651
 		$params = parent::get_collection_params();
652 652
 
653
-		$params['dp'] = array(
653
+		$params[ 'dp' ] = array(
654 654
 			'default'           => wc_get_price_decimals(),
655 655
 			'description'       => __( 'Number of decimal points to use in each resource.', 'woocommerce' ),
656 656
 			'type'              => 'integer',
@@ -658,7 +658,7 @@  discard block
 block discarded – undo
658 658
 			'validate_callback' => 'rest_validate_request_arg',
659 659
 		);
660 660
 
661
-		unset( $params['status'], $params['customer'], $params['product'] );
661
+		unset( $params[ 'status' ], $params[ 'customer' ], $params[ 'product' ] );
662 662
 
663 663
 		return $params;
664 664
 	}
Please login to merge, or discard this patch.
src/Controllers/Version4/Responses/ProductReviewResponse.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
 		);
38 38
 
39 39
 		if ( 'view' === $context ) {
40
-			$data['review'] = wpautop( $data['review'] );
40
+			$data[ 'review' ] = wpautop( $data[ 'review' ] );
41 41
 		}
42 42
 
43 43
 		return $data;
Please login to merge, or discard this patch.
src/Controllers/Version4/Responses/OrderResponse.php 1 patch
Spacing   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 		}
64 64
 
65 65
 		// Format the order status.
66
-		$data['status'] = 'wc-' === substr( $data['status'], 0, 3 ) ? substr( $data['status'], 3 ) : $data['status'];
66
+		$data[ 'status' ] = 'wc-' === substr( $data[ 'status' ], 0, 3 ) ? substr( $data[ 'status' ], 3 ) : $data[ 'status' ];
67 67
 
68 68
 		// Format line items.
69 69
 		foreach ( $format_line_items as $key ) {
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
 		}
72 72
 
73 73
 		// Refunds.
74
-		$data['refunds'] = array();
74
+		$data[ 'refunds' ] = array();
75 75
 		foreach ( $object->get_refunds() as $refund ) {
76
-			$data['refunds'][] = array(
76
+			$data[ 'refunds' ][ ] = array(
77 77
 				'id'     => $refund->get_id(),
78 78
 				'reason' => $refund->get_reason() ? $refund->get_reason() : '',
79 79
 				'total'  => '-' . wc_format_decimal( $refund->get_amount(), $this->dp ),
@@ -81,52 +81,52 @@  discard block
 block discarded – undo
81 81
 		}
82 82
 
83 83
 		// Currency symbols.
84
-		$currency_symbol         = get_woocommerce_currency_symbol( $data['currency'] );
85
-		$data['currency_symbol'] = html_entity_decode( $currency_symbol );
84
+		$currency_symbol         = get_woocommerce_currency_symbol( $data[ 'currency' ] );
85
+		$data[ 'currency_symbol' ] = html_entity_decode( $currency_symbol );
86 86
 
87 87
 		return array(
88 88
 			'id'                   => $object->get_id(),
89
-			'parent_id'            => $data['parent_id'],
90
-			'number'               => $data['number'],
91
-			'order_key'            => $data['order_key'],
92
-			'created_via'          => $data['created_via'],
93
-			'version'              => $data['version'],
94
-			'status'               => $data['status'],
95
-			'currency'             => $data['currency'],
96
-			'currency_symbol'      => $data['currency_symbol'],
97
-			'date_created'         => $data['date_created'],
98
-			'date_created_gmt'     => $data['date_created_gmt'],
99
-			'date_modified'        => $data['date_modified'],
100
-			'date_modified_gmt'    => $data['date_modified_gmt'],
101
-			'discount_total'       => $data['discount_total'],
102
-			'discount_tax'         => $data['discount_tax'],
103
-			'shipping_total'       => $data['shipping_total'],
104
-			'shipping_tax'         => $data['shipping_tax'],
105
-			'cart_tax'             => $data['cart_tax'],
106
-			'total'                => $data['total'],
107
-			'total_tax'            => $data['total_tax'],
108
-			'prices_include_tax'   => $data['prices_include_tax'],
109
-			'customer_id'          => $data['customer_id'],
110
-			'customer_ip_address'  => $data['customer_ip_address'],
111
-			'customer_user_agent'  => $data['customer_user_agent'],
112
-			'customer_note'        => $data['customer_note'],
113
-			'billing'              => $data['billing'],
114
-			'shipping'             => $data['shipping'],
115
-			'payment_method'       => $data['payment_method'],
116
-			'payment_method_title' => $data['payment_method_title'],
117
-			'transaction_id'       => $data['transaction_id'],
118
-			'date_paid'            => $data['date_paid'],
119
-			'date_paid_gmt'        => $data['date_paid_gmt'],
120
-			'date_completed'       => $data['date_completed'],
121
-			'date_completed_gmt'   => $data['date_completed_gmt'],
122
-			'cart_hash'            => $data['cart_hash'],
123
-			'meta_data'            => $data['meta_data'],
124
-			'line_items'           => $data['line_items'],
125
-			'tax_lines'            => $data['tax_lines'],
126
-			'shipping_lines'       => $data['shipping_lines'],
127
-			'fee_lines'            => $data['fee_lines'],
128
-			'coupon_lines'         => $data['coupon_lines'],
129
-			'refunds'              => $data['refunds'],
89
+			'parent_id'            => $data[ 'parent_id' ],
90
+			'number'               => $data[ 'number' ],
91
+			'order_key'            => $data[ 'order_key' ],
92
+			'created_via'          => $data[ 'created_via' ],
93
+			'version'              => $data[ 'version' ],
94
+			'status'               => $data[ 'status' ],
95
+			'currency'             => $data[ 'currency' ],
96
+			'currency_symbol'      => $data[ 'currency_symbol' ],
97
+			'date_created'         => $data[ 'date_created' ],
98
+			'date_created_gmt'     => $data[ 'date_created_gmt' ],
99
+			'date_modified'        => $data[ 'date_modified' ],
100
+			'date_modified_gmt'    => $data[ 'date_modified_gmt' ],
101
+			'discount_total'       => $data[ 'discount_total' ],
102
+			'discount_tax'         => $data[ 'discount_tax' ],
103
+			'shipping_total'       => $data[ 'shipping_total' ],
104
+			'shipping_tax'         => $data[ 'shipping_tax' ],
105
+			'cart_tax'             => $data[ 'cart_tax' ],
106
+			'total'                => $data[ 'total' ],
107
+			'total_tax'            => $data[ 'total_tax' ],
108
+			'prices_include_tax'   => $data[ 'prices_include_tax' ],
109
+			'customer_id'          => $data[ 'customer_id' ],
110
+			'customer_ip_address'  => $data[ 'customer_ip_address' ],
111
+			'customer_user_agent'  => $data[ 'customer_user_agent' ],
112
+			'customer_note'        => $data[ 'customer_note' ],
113
+			'billing'              => $data[ 'billing' ],
114
+			'shipping'             => $data[ 'shipping' ],
115
+			'payment_method'       => $data[ 'payment_method' ],
116
+			'payment_method_title' => $data[ 'payment_method_title' ],
117
+			'transaction_id'       => $data[ 'transaction_id' ],
118
+			'date_paid'            => $data[ 'date_paid' ],
119
+			'date_paid_gmt'        => $data[ 'date_paid_gmt' ],
120
+			'date_completed'       => $data[ 'date_completed' ],
121
+			'date_completed_gmt'   => $data[ 'date_completed_gmt' ],
122
+			'cart_hash'            => $data[ 'cart_hash' ],
123
+			'meta_data'            => $data[ 'meta_data' ],
124
+			'line_items'           => $data[ 'line_items' ],
125
+			'tax_lines'            => $data[ 'tax_lines' ],
126
+			'shipping_lines'       => $data[ 'shipping_lines' ],
127
+			'fee_lines'            => $data[ 'fee_lines' ],
128
+			'coupon_lines'         => $data[ 'coupon_lines' ],
129
+			'refunds'              => $data[ 'refunds' ],
130 130
 		);
131 131
 	}
132 132
 
@@ -149,34 +149,34 @@  discard block
 block discarded – undo
149 149
 
150 150
 		// Add SKU and PRICE to products.
151 151
 		if ( is_callable( array( $item, 'get_product' ) ) ) {
152
-			$data['sku']   = $item->get_product() ? $item->get_product()->get_sku() : null;
153
-			$data['price'] = $item->get_quantity() ? $item->get_total() / $item->get_quantity() : 0;
152
+			$data[ 'sku' ]   = $item->get_product() ? $item->get_product()->get_sku() : null;
153
+			$data[ 'price' ] = $item->get_quantity() ? $item->get_total() / $item->get_quantity() : 0;
154 154
 		}
155 155
 
156 156
 		// Format taxes.
157
-		if ( ! empty( $data['taxes']['total'] ) ) {
157
+		if ( ! empty( $data[ 'taxes' ][ 'total' ] ) ) {
158 158
 			$taxes = array();
159 159
 
160
-			foreach ( $data['taxes']['total'] as $tax_rate_id => $tax ) {
161
-				$taxes[] = array(
160
+			foreach ( $data[ 'taxes' ][ 'total' ] as $tax_rate_id => $tax ) {
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
-			$data['taxes'] = $taxes;
168
-		} elseif ( isset( $data['taxes'] ) ) {
169
-			$data['taxes'] = array();
167
+			$data[ 'taxes' ] = $taxes;
168
+		} elseif ( isset( $data[ 'taxes' ] ) ) {
169
+			$data[ 'taxes' ] = array();
170 170
 		}
171 171
 
172 172
 		// Remove names for coupons, taxes and shipping.
173
-		if ( isset( $data['code'] ) || isset( $data['rate_code'] ) || isset( $data['method_title'] ) ) {
174
-			unset( $data['name'] );
173
+		if ( isset( $data[ 'code' ] ) || isset( $data[ 'rate_code' ] ) || isset( $data[ 'method_title' ] ) ) {
174
+			unset( $data[ 'name' ] );
175 175
 		}
176 176
 
177 177
 		// Remove props we don't want to expose.
178
-		unset( $data['order_id'] );
179
-		unset( $data['type'] );
178
+		unset( $data[ 'order_id' ] );
179
+		unset( $data[ 'type' ] );
180 180
 
181 181
 		return $data;
182 182
 	}
Please login to merge, or discard this patch.
src/Controllers/Version4/Responses/ProductResponse.php 1 patch
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -96,25 +96,25 @@  discard block
 block discarded – undo
96 96
 
97 97
 		// Add variations to variable products.
98 98
 		if ( $object->is_type( 'variable' ) ) {
99
-			$data['variations'] = $object->get_children();
99
+			$data[ 'variations' ] = $object->get_children();
100 100
 		}
101 101
 
102 102
 		// Add grouped products data.
103 103
 		if ( $object->is_type( 'grouped' ) ) {
104
-			$data['grouped_products'] = $object->get_children();
104
+			$data[ 'grouped_products' ] = $object->get_children();
105 105
 		}
106 106
 
107 107
 		// Add external product data.
108 108
 		if ( $object->is_type( 'external' ) ) {
109
-			$data['external_url'] = $object->get_product_url( $context );
110
-			$data['button_text']  = $object->get_button_text( $context );
109
+			$data[ 'external_url' ] = $object->get_product_url( $context );
110
+			$data[ 'button_text' ]  = $object->get_button_text( $context );
111 111
 		}
112 112
 
113 113
 		if ( 'view' === $context ) {
114
-			$data['description']       = wpautop( do_shortcode( $data['description'] ) );
115
-			$data['short_description'] = apply_filters( 'woocommerce_short_description', $data['short_description'] );
116
-			$data['average_rating']    = wc_format_decimal( $data['average_rating'], 2 );
117
-			$data['purchase_note']     = wpautop( do_shortcode( $data['purchase_note'] ) );
114
+			$data[ 'description' ]       = wpautop( do_shortcode( $data[ 'description' ] ) );
115
+			$data[ 'short_description' ] = apply_filters( 'woocommerce_short_description', $data[ 'short_description' ] );
116
+			$data[ 'average_rating' ]    = wc_format_decimal( $data[ 'average_rating' ], 2 );
117
+			$data[ 'purchase_note' ]     = wpautop( do_shortcode( $data[ 'purchase_note' ] ) );
118 118
 		}
119 119
 
120 120
 		return $data;
@@ -132,10 +132,10 @@  discard block
 block discarded – undo
132 132
 
133 133
 		if ( $object->is_downloadable() ) {
134 134
 			foreach ( $object->get_downloads() as $file_id => $file ) {
135
-				$downloads[] = array(
135
+				$downloads[ ] = array(
136 136
 					'id'   => $file_id, // MD5 hash.
137
-					'name' => $file['name'],
138
-					'file' => $file['file'],
137
+					'name' => $file[ 'name' ],
138
+					'file' => $file[ 'file' ],
139 139
 				);
140 140
 			}
141 141
 		}
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 		$terms = array();
156 156
 
157 157
 		foreach ( wc_get_object_terms( $object->get_id(), 'product_' . $taxonomy ) as $term ) {
158
-			$terms[] = array(
158
+			$terms[ ] = array(
159 159
 				'id'   => $term->term_id,
160 160
 				'name' => $term->name,
161 161
 				'slug' => $term->slug,
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 
178 178
 		// Add featured image.
179 179
 		if ( $object->get_image_id() ) {
180
-			$attachment_ids[] = $object->get_image_id();
180
+			$attachment_ids[ ] = $object->get_image_id();
181 181
 		}
182 182
 
183 183
 		// Add gallery images.
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 				continue;
196 196
 			}
197 197
 
198
-			$images[] = array(
198
+			$images[ ] = array(
199 199
 				'id'                => (int) $attachment_id,
200 200
 				'date_created'      => wc_rest_prepare_date_response( $attachment_post->post_date, false ),
201 201
 				'date_created_gmt'  => wc_rest_prepare_date_response( strtotime( $attachment_post->post_date_gmt ) ),
@@ -223,13 +223,13 @@  discard block
 block discarded – undo
223 223
 		if ( $object->is_type( 'variable' ) ) {
224 224
 			foreach ( array_filter( (array) $object->get_default_attributes(), 'strlen' ) as $key => $value ) {
225 225
 				if ( 0 === strpos( $key, 'pa_' ) ) {
226
-					$default[] = array(
226
+					$default[ ] = array(
227 227
 						'id'     => wc_attribute_taxonomy_id_by_name( $key ),
228 228
 						'name'   => $this->get_attribute_taxonomy_name( $key, $object ),
229 229
 						'option' => $value,
230 230
 					);
231 231
 				} else {
232
-					$default[] = array(
232
+					$default[ ] = array(
233 233
 						'id'     => 0,
234 234
 						'name'   => $this->get_attribute_taxonomy_name( $key, $object ),
235 235
 						'option' => $value,
@@ -263,13 +263,13 @@  discard block
 block discarded – undo
263 263
 				// Taxonomy-based attributes are prefixed with `pa_`, otherwise simply `attribute_`.
264 264
 				if ( 0 === strpos( $attribute_name, 'attribute_pa_' ) ) {
265 265
 					$option_term  = get_term_by( 'slug', $attribute, $name );
266
-					$attributes[] = array(
266
+					$attributes[ ] = array(
267 267
 						'id'     => wc_attribute_taxonomy_id_by_name( $name ),
268 268
 						'name'   => $this->get_attribute_taxonomy_name( $name, $_product ),
269 269
 						'option' => $option_term && ! is_wp_error( $option_term ) ? $option_term->name : $attribute,
270 270
 					);
271 271
 				} else {
272
-					$attributes[] = array(
272
+					$attributes[ ] = array(
273 273
 						'id'     => 0,
274 274
 						'name'   => $this->get_attribute_taxonomy_name( $name, $_product ),
275 275
 						'option' => $attribute,
@@ -278,12 +278,12 @@  discard block
 block discarded – undo
278 278
 			}
279 279
 		} else {
280 280
 			foreach ( $object->get_attributes() as $attribute ) {
281
-				$attributes[] = array(
282
-					'id'        => $attribute['is_taxonomy'] ? wc_attribute_taxonomy_id_by_name( $attribute['name'] ) : 0,
283
-					'name'      => $this->get_attribute_taxonomy_name( $attribute['name'], $object ),
284
-					'position'  => (int) $attribute['position'],
285
-					'visible'   => (bool) $attribute['is_visible'],
286
-					'variation' => (bool) $attribute['is_variation'],
281
+				$attributes[ ] = array(
282
+					'id'        => $attribute[ 'is_taxonomy' ] ? wc_attribute_taxonomy_id_by_name( $attribute[ 'name' ] ) : 0,
283
+					'name'      => $this->get_attribute_taxonomy_name( $attribute[ 'name' ], $object ),
284
+					'position'  => (int) $attribute[ 'position' ],
285
+					'visible'   => (bool) $attribute[ 'is_visible' ],
286
+					'variation' => (bool) $attribute[ 'is_variation' ],
287 287
 					'options'   => $this->get_attribute_options( $object->get_id(), $attribute ),
288 288
 				);
289 289
 			}
@@ -337,16 +337,16 @@  discard block
 block discarded – undo
337 337
 	 * @return array
338 338
 	 */
339 339
 	protected function get_attribute_options( $object_id, $attribute ) {
340
-		if ( isset( $attribute['is_taxonomy'] ) && $attribute['is_taxonomy'] ) {
340
+		if ( isset( $attribute[ 'is_taxonomy' ] ) && $attribute[ 'is_taxonomy' ] ) {
341 341
 			return wc_get_product_terms(
342 342
 				$object_id,
343
-				$attribute['name'],
343
+				$attribute[ 'name' ],
344 344
 				array(
345 345
 					'fields' => 'names',
346 346
 				)
347 347
 			);
348
-		} elseif ( isset( $attribute['value'] ) ) {
349
-			return array_map( 'trim', explode( '|', $attribute['value'] ) );
348
+		} elseif ( isset( $attribute[ 'value' ] ) ) {
349
+			return array_map( 'trim', explode( '|', $attribute[ 'value' ] ) );
350 350
 		}
351 351
 
352 352
 		return array();
Please login to merge, or discard this patch.
src/Controllers/Version4/Responses/CustomerResponse.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -35,20 +35,20 @@
 block discarded – undo
35 35
 
36 36
 		return array(
37 37
 			'id'                 => $object->get_id(),
38
-			'date_created'       => $data['date_created'],
39
-			'date_created_gmt'   => $data['date_created_gmt'],
40
-			'date_modified'      => $data['date_modified'],
41
-			'date_modified_gmt'  => $data['date_modified_gmt'],
42
-			'email'              => $data['email'],
43
-			'first_name'         => $data['first_name'],
44
-			'last_name'          => $data['last_name'],
45
-			'role'               => $data['role'],
46
-			'username'           => $data['username'],
47
-			'billing'            => $data['billing'],
48
-			'shipping'           => $data['shipping'],
49
-			'is_paying_customer' => $data['is_paying_customer'],
38
+			'date_created'       => $data[ 'date_created' ],
39
+			'date_created_gmt'   => $data[ 'date_created_gmt' ],
40
+			'date_modified'      => $data[ 'date_modified' ],
41
+			'date_modified_gmt'  => $data[ 'date_modified_gmt' ],
42
+			'email'              => $data[ 'email' ],
43
+			'first_name'         => $data[ 'first_name' ],
44
+			'last_name'          => $data[ 'last_name' ],
45
+			'role'               => $data[ 'role' ],
46
+			'username'           => $data[ 'username' ],
47
+			'billing'            => $data[ 'billing' ],
48
+			'shipping'           => $data[ 'shipping' ],
49
+			'is_paying_customer' => $data[ 'is_paying_customer' ],
50 50
 			'avatar_url'         => $object->get_avatar_url(),
51
-			'meta_data'          => $data['meta_data'],
51
+			'meta_data'          => $data[ 'meta_data' ],
52 52
 		);
53 53
 	}
54 54
 }
Please login to merge, or discard this patch.