Passed
Push — master ( f8a28a...ab42dc )
by Mike
04:36
created
src/Controllers/Version4/Orders.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
 
77 77
 		// Format decimal values.
78 78
 		foreach ( $format_decimal as $key ) {
79
-			if ( isset( $data[ $key ] ) ) {
80
-				$data[ $key ] = wc_format_decimal( $data[ $key ], $this->request['dp'] );
79
+			if ( isset( $data[$key] ) ) {
80
+				$data[$key] = wc_format_decimal( $data[$key], $this->request['dp'] );
81 81
 			}
82 82
 		}
83 83
 
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 				$taxes[] = array(
96 96
 					'id'       => $tax_rate_id,
97 97
 					'total'    => $tax,
98
-					'subtotal' => isset( $data['taxes']['subtotal'][ $tax_rate_id ] ) ? $data['taxes']['subtotal'][ $tax_rate_id ] : '',
98
+					'subtotal' => isset( $data['taxes']['subtotal'][$tax_rate_id] ) ? $data['taxes']['subtotal'][$tax_rate_id] : '',
99 99
 				);
100 100
 			}
101 101
 			$data['taxes'] = $taxes;
@@ -1220,7 +1220,7 @@  discard block
 block discarded – undo
1220 1220
 	public function get_collection_params() {
1221 1221
 		$params = parent::get_collection_params();
1222 1222
 
1223
-		$params['status']   = array(
1223
+		$params['status'] = array(
1224 1224
 			'default'           => 'any',
1225 1225
 			'description'       => __( 'Limit result set to orders which have specific statuses.', 'woocommerce' ),
1226 1226
 			'type'              => 'array',
@@ -1236,13 +1236,13 @@  discard block
 block discarded – undo
1236 1236
 			'sanitize_callback' => 'absint',
1237 1237
 			'validate_callback' => 'rest_validate_request_arg',
1238 1238
 		);
1239
-		$params['product']  = array(
1239
+		$params['product'] = array(
1240 1240
 			'description'       => __( 'Limit result set to orders assigned a specific product.', 'woocommerce' ),
1241 1241
 			'type'              => 'integer',
1242 1242
 			'sanitize_callback' => 'absint',
1243 1243
 			'validate_callback' => 'rest_validate_request_arg',
1244 1244
 		);
1245
-		$params['dp']       = array(
1245
+		$params['dp'] = array(
1246 1246
 			'default'           => wc_get_price_decimals(),
1247 1247
 			'description'       => __( 'Number of decimal points to use in each resource.', 'woocommerce' ),
1248 1248
 			'type'              => 'integer',
Please login to merge, or discard this patch.
src/Controllers/Version4/Schema/OrderRequest.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
src/Controllers/Version4/Schema/OrderResponse.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -52,14 +52,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.