Code Duplication    Length = 3-3 lines in 4 locations

includes/api/class-wc-rest-order-refunds-controller.php 1 location

@@ 139-141 (lines=3) @@
136
		}
137
138
		// Format date values.
139
		foreach ( $format_date as $key ) {
140
			$data[ $key ] = $data[ $key ] ? wc_rest_prepare_date_response( get_gmt_from_date( date( 'Y-m-d H:i:s', $data[ $key ] ) ) ) : false;
141
		}
142
143
		// Format line items.
144
		foreach ( $format_line_items as $key ) {

includes/api/class-wc-rest-orders-controller.php 1 location

@@ 202-204 (lines=3) @@
199
		}
200
201
		// Format date values.
202
		foreach ( $format_date as $key ) {
203
			$data[ $key ] = $data[ $key ] ? wc_rest_prepare_date_response( get_gmt_from_date( date( 'Y-m-d H:i:s', $data[ $key ] ) ) ) : false;
204
		}
205
206
		// Format the order status.
207
		$data['status'] = 'wc-' === substr( $data['status'], 0, 3 ) ? substr( $data['status'], 3 ) : $data['status'];

includes/api/class-wc-rest-coupons-controller.php 1 location

@@ 156-158 (lines=3) @@
153
		}
154
155
		// Format date values.
156
		foreach ( $format_date as $key ) {
157
			$data[ $key ] = $data[ $key ] ? wc_rest_prepare_date_response( get_gmt_from_date( date( 'Y-m-d H:i:s', $data[ $key ] ) ) ) : null;
158
		}
159
160
		// Format null values.
161
		foreach ( $format_null as $key ) {

includes/api/class-wc-rest-customers-controller.php 1 location

@@ 494-496 (lines=3) @@
491
		$format_date = array( 'date_created', 'date_modified' );
492
493
		// Format date values.
494
		foreach ( $format_date as $key ) {
495
			$data[ $key ] = $data[ $key ] ? wc_rest_prepare_date_response( get_gmt_from_date( date( 'Y-m-d H:i:s', $data[ $key ] ) ) ) : null;
496
		}
497
498
		// Remove unwanted CRUD data.
499
		unset( $data['role'] );