Passed
Push — master ( 5bd17a...71a32c )
by Mike
04:53
created
src/Controllers/Version4/Taxes.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 			'id'    => 'tax_rate_id',
121 121
 			'order' => 'tax_rate_order',
122 122
 		);
123
-		$prepared_args['orderby'] = $orderby_possibles[ $request['orderby'] ];
123
+		$prepared_args['orderby'] = $orderby_possibles[$request['orderby']];
124 124
 		$prepared_args['class']   = $request['class'];
125 125
 		$prepared_args['code']    = $request['code'];
126 126
 		$prepared_args['include'] = $request['include'];
@@ -235,12 +235,12 @@  discard block
 block discarded – undo
235 235
 			$key = 'tax_rate' === $field ? 'rate' : str_replace( 'tax_rate_', '', $field );
236 236
 
237 237
 			// Remove data that was not posted.
238
-			if ( ! isset( $request[ $key ] ) ) {
238
+			if ( ! isset( $request[$key] ) ) {
239 239
 				continue;
240 240
 			}
241 241
 
242 242
 			// Test new data against current data.
243
-			if ( $current && $current->$field === $request[ $key ] ) {
243
+			if ( $current && $current->$field === $request[$key] ) {
244 244
 				continue;
245 245
 			}
246 246
 
@@ -250,13 +250,13 @@  discard block
 block discarded – undo
250 250
 				case 'tax_rate_compound':
251 251
 				case 'tax_rate_shipping':
252 252
 				case 'tax_rate_order':
253
-					$data[ $field ] = absint( $request[ $key ] );
253
+					$data[$field] = absint( $request[$key] );
254 254
 					break;
255 255
 				case 'tax_rate_class':
256
-					$data[ $field ] = 'standard' !== $request['tax_rate_class'] ? $request['tax_rate_class'] : '';
256
+					$data[$field] = 'standard' !== $request['tax_rate_class'] ? $request['tax_rate_class'] : '';
257 257
 					break;
258 258
 				default:
259
-					$data[ $field ] = wc_clean( $request[ $key ] );
259
+					$data[$field] = wc_clean( $request[$key] );
260 260
 					break;
261 261
 			}
262 262
 		}
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
 
450 450
 		if ( ! is_wp_error( $locales ) && ! is_null( $locales ) ) {
451 451
 			foreach ( $locales as $locale ) {
452
-				$data[ $locale->location_type ] = $locale->location_code;
452
+				$data[$locale->location_type] = $locale->location_code;
453 453
 			}
454 454
 		}
455 455
 		return $data;
@@ -617,7 +617,7 @@  discard block
 block discarded – undo
617 617
 			'type'               => 'string',
618 618
 			'validate_callback'  => 'rest_validate_request_arg',
619 619
 		);
620
-		$params['code']    = array(
620
+		$params['code'] = array(
621 621
 			'description'       => __( 'Search by similar tax code.', 'woocommerce' ),
622 622
 			'type'              => 'string',
623 623
 			'validate_callback' => 'rest_validate_request_arg',
Please login to merge, or discard this patch.
src/Controllers/Version4/Products.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -963,8 +963,8 @@  discard block
 block discarded – undo
963 963
 			'low_in_stock',
964 964
 		);
965 965
 		foreach ( $custom_keys as $key ) {
966
-			if ( ! empty( $request[ $key ] ) ) {
967
-				$args[ $key ] = $request[ $key ];
966
+			if ( ! empty( $request[$key] ) ) {
967
+				$args[$key] = $request[$key];
968 968
 			}
969 969
 		}
970 970
 
@@ -981,11 +981,11 @@  discard block
 block discarded – undo
981 981
 
982 982
 		// Set tax_query for each passed arg.
983 983
 		foreach ( $taxonomies as $taxonomy => $key ) {
984
-			if ( ! empty( $request[ $key ] ) ) {
984
+			if ( ! empty( $request[$key] ) ) {
985 985
 				$tax_query[] = array(
986 986
 					'taxonomy' => $taxonomy,
987 987
 					'field'    => 'term_id',
988
-					'terms'    => $request[ $key ],
988
+					'terms'    => $request[$key],
989 989
 				);
990 990
 			}
991 991
 		}
@@ -1048,7 +1048,7 @@  discard block
 block discarded – undo
1048 1048
 			// Use 0 when there's no on sale products to avoid return all products.
1049 1049
 			$on_sale_ids = empty( $on_sale_ids ) ? array( 0 ) : $on_sale_ids;
1050 1050
 
1051
-			$args[ $on_sale_key ] += $on_sale_ids;
1051
+			$args[$on_sale_key] += $on_sale_ids;
1052 1052
 		}
1053 1053
 
1054 1054
 		// Force the post_type argument, since it's not a user input variable.
@@ -1081,16 +1081,16 @@  discard block
 block discarded – undo
1081 1081
 	protected function prepare_links( $item, $request ) {
1082 1082
 		$links = array(
1083 1083
 			'self'       => array(
1084
-				'href' => rest_url( sprintf( '/%s/%s/%d', $this->namespace, $this->rest_base, $item->get_id() ) ),  // @codingStandardsIgnoreLine.
1084
+				'href' => rest_url( sprintf( '/%s/%s/%d', $this->namespace, $this->rest_base, $item->get_id() ) ), // @codingStandardsIgnoreLine.
1085 1085
 			),
1086 1086
 			'collection' => array(
1087
-				'href' => rest_url( sprintf( '/%s/%s', $this->namespace, $this->rest_base ) ),  // @codingStandardsIgnoreLine.
1087
+				'href' => rest_url( sprintf( '/%s/%s', $this->namespace, $this->rest_base ) ), // @codingStandardsIgnoreLine.
1088 1088
 			),
1089 1089
 		);
1090 1090
 
1091 1091
 		if ( $item->get_parent_id() ) {
1092 1092
 			$links['up'] = array(
1093
-				'href' => rest_url( sprintf( '/%s/products/%d', $this->namespace, $item->get_parent_id() ) ),  // @codingStandardsIgnoreLine.
1093
+				'href' => rest_url( sprintf( '/%s/products/%d', $this->namespace, $item->get_parent_id() ) ), // @codingStandardsIgnoreLine.
1094 1094
 			);
1095 1095
 		}
1096 1096
 
Please login to merge, or discard this patch.
src/Controllers/Version4/OrderRefunds.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -147,19 +147,19 @@  discard block
 block discarded – undo
147 147
 
148 148
 		// Format decimal values.
149 149
 		foreach ( $format_decimal as $key ) {
150
-			$data[ $key ] = wc_format_decimal( $data[ $key ], $dp );
150
+			$data[$key] = wc_format_decimal( $data[$key], $dp );
151 151
 		}
152 152
 
153 153
 		// Format date values.
154 154
 		foreach ( $format_date as $key ) {
155
-			$datetime              = $data[ $key ];
156
-			$data[ $key ]          = wc_rest_prepare_date_response( $datetime, false );
157
-			$data[ $key . '_gmt' ] = wc_rest_prepare_date_response( $datetime );
155
+			$datetime              = $data[$key];
156
+			$data[$key]          = wc_rest_prepare_date_response( $datetime, false );
157
+			$data[$key . '_gmt'] = wc_rest_prepare_date_response( $datetime );
158 158
 		}
159 159
 
160 160
 		// Format line items.
161 161
 		foreach ( $format_line_items as $key ) {
162
-			$data[ $key ] = array_values( array_map( array( $this, 'get_order_item_data' ), $data[ $key ], $request ) );
162
+			$data[$key] = array_values( array_map( array( $this, 'get_order_item_data' ), $data[$key], $request ) );
163 163
 		}
164 164
 
165 165
 		return array(
@@ -189,8 +189,8 @@  discard block
 block discarded – undo
189 189
 
190 190
 		// Format decimal values.
191 191
 		foreach ( $format_decimal as $key ) {
192
-			if ( isset( $data[ $key ] ) ) {
193
-				$data[ $key ] = wc_format_decimal( $data[ $key ], $this->request['dp'] );
192
+			if ( isset( $data[$key] ) ) {
193
+				$data[$key] = wc_format_decimal( $data[$key], $this->request['dp'] );
194 194
 			}
195 195
 		}
196 196
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 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 214
 			$data['taxes'] = $taxes;
Please login to merge, or discard this patch.
src/Controllers/Version4/Orders.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1144,7 +1144,7 @@  discard block
 block discarded – undo
1144 1144
 	public function get_collection_params() {
1145 1145
 		$params = parent::get_collection_params();
1146 1146
 
1147
-		$params['status']   = array(
1147
+		$params['status'] = array(
1148 1148
 			'default'           => 'any',
1149 1149
 			'description'       => __( 'Limit result set to orders which have specific statuses.', 'woocommerce' ),
1150 1150
 			'type'              => 'array',
@@ -1160,13 +1160,13 @@  discard block
 block discarded – undo
1160 1160
 			'sanitize_callback' => 'absint',
1161 1161
 			'validate_callback' => 'rest_validate_request_arg',
1162 1162
 		);
1163
-		$params['product']  = array(
1163
+		$params['product'] = array(
1164 1164
 			'description'       => __( 'Limit result set to orders assigned a specific product.', 'woocommerce' ),
1165 1165
 			'type'              => 'integer',
1166 1166
 			'sanitize_callback' => 'absint',
1167 1167
 			'validate_callback' => 'rest_validate_request_arg',
1168 1168
 		);
1169
-		$params['dp']       = array(
1169
+		$params['dp'] = array(
1170 1170
 			'default'           => wc_get_price_decimals(),
1171 1171
 			'description'       => __( 'Number of decimal points to use in each resource.', 'woocommerce' ),
1172 1172
 			'type'              => 'integer',
Please login to merge, or discard this patch.
src/Controllers/Version4/Utilities/Permissions.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -114,10 +114,10 @@
 block discarded – undo
114 114
 	 * @return array List of caps to check. Defaults to manage_woocommerce.
115 115
 	 */
116 116
 	protected static function get_capabilities_for_type( $type, $context = 'read' ) {
117
-		if ( isset( self::$capabilities[ $type ][ $context ] ) ) {
118
-			$caps = self::$capabilities[ $type ][ $context ];
119
-		} elseif ( isset( self::$capabilities[ $type ] ) ) {
120
-			$caps = self::$capabilities[ $type ];
117
+		if ( isset( self::$capabilities[$type][$context] ) ) {
118
+			$caps = self::$capabilities[$type][$context];
119
+		} elseif ( isset( self::$capabilities[$type] ) ) {
120
+			$caps = self::$capabilities[$type];
121 121
 		} else {
122 122
 			$caps = 'manage_woocommerce';
123 123
 		}
Please login to merge, or discard this patch.
src/Controllers/Version4/PaymentGateways.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -137,17 +137,17 @@  discard block
 block discarded – undo
137 137
 		if ( isset( $request['settings'] ) ) {
138 138
 			$errors_found = false;
139 139
 			foreach ( $gateway->form_fields as $key => $field ) {
140
-				if ( isset( $request['settings'][ $key ] ) ) {
140
+				if ( isset( $request['settings'][$key] ) ) {
141 141
 					if ( is_callable( array( $this, 'validate_setting_' . $field['type'] . '_field' ) ) ) {
142
-						$value = $this->{'validate_setting_' . $field['type'] . '_field'}( $request['settings'][ $key ], $field );
142
+						$value = $this->{'validate_setting_' . $field['type'] . '_field'}( $request['settings'][$key], $field );
143 143
 					} else {
144
-						$value = $this->validate_setting_text_field( $request['settings'][ $key ], $field );
144
+						$value = $this->validate_setting_text_field( $request['settings'][$key], $field );
145 145
 					}
146 146
 					if ( is_wp_error( $value ) ) {
147 147
 						$errors_found = true;
148 148
 						break;
149 149
 					}
150
-					$settings[ $key ] = $value;
150
+					$settings[$key] = $value;
151 151
 				}
152 152
 			}
153 153
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 		// Update order.
182 182
 		if ( isset( $request['order'] ) ) {
183 183
 			$order                 = (array) get_option( 'woocommerce_gateway_order' );
184
-			$order[ $gateway->id ] = $request['order'];
184
+			$order[$gateway->id] = $request['order'];
185 185
 			update_option( 'woocommerce_gateway_order', $order );
186 186
 			$gateway->order = absint( $request['order'] );
187 187
 		}
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 			'id'                 => $object->id,
223 223
 			'title'              => $object->title,
224 224
 			'description'        => $object->description,
225
-			'order'              => isset( $order[ $object->id ] ) ? $order[ $object->id ] : '',
225
+			'order'              => isset( $order[$object->id] ) ? $order[$object->id] : '',
226 226
 			'enabled'            => ( 'yes' === $object->enabled ),
227 227
 			'method_title'       => $object->get_method_title(),
228 228
 			'method_description' => $object->get_method_description(),
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
 				'label'       => empty( $field['label'] ) ? $field['title'] : $field['label'],
258 258
 				'description' => empty( $field['description'] ) ? '' : $field['description'],
259 259
 				'type'        => $field['type'],
260
-				'value'       => empty( $gateway->settings[ $id ] ) ? '' : $gateway->settings[ $id ],
260
+				'value'       => empty( $gateway->settings[$id] ) ? '' : $gateway->settings[$id],
261 261
 				'default'     => empty( $field['default'] ) ? '' : $field['default'],
262 262
 				'tip'         => empty( $field['description'] ) ? '' : $field['description'],
263 263
 				'placeholder' => empty( $field['placeholder'] ) ? '' : $field['placeholder'],
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 			if ( ! empty( $field['options'] ) ) {
266 266
 				$data['options'] = $field['options'];
267 267
 			}
268
-			$settings[ $id ] = $data;
268
+			$settings[$id] = $data;
269 269
 		}
270 270
 		return $settings;
271 271
 	}
Please login to merge, or discard this patch.