Passed
Push — master ( f8a28a...ab42dc )
by Mike
04:36
created
src/Autoloader.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@
 block discarded – undo
76 76
 		}
77 77
 
78 78
 		if ( array_key_exists( $class, self::$classmap ) ) {
79
-			return include self::$classmap[ $class ];
79
+			return include self::$classmap[$class];
80 80
 		}
81 81
 	}
82 82
 }
Please login to merge, or discard this patch.
src/Controllers/Version4/OrderRefunds.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -141,19 +141,19 @@  discard block
 block discarded – undo
141 141
 
142 142
 		// Format decimal values.
143 143
 		foreach ( $format_decimal as $key ) {
144
-			$data[ $key ] = wc_format_decimal( $data[ $key ], $this->request['dp'] );
144
+			$data[$key] = wc_format_decimal( $data[$key], $this->request['dp'] );
145 145
 		}
146 146
 
147 147
 		// Format date values.
148 148
 		foreach ( $format_date as $key ) {
149
-			$datetime              = $data[ $key ];
150
-			$data[ $key ]          = wc_rest_prepare_date_response( $datetime, false );
151
-			$data[ $key . '_gmt' ] = wc_rest_prepare_date_response( $datetime );
149
+			$datetime              = $data[$key];
150
+			$data[$key]          = wc_rest_prepare_date_response( $datetime, false );
151
+			$data[$key . '_gmt'] = wc_rest_prepare_date_response( $datetime );
152 152
 		}
153 153
 
154 154
 		// Format line items.
155 155
 		foreach ( $format_line_items as $key ) {
156
-			$data[ $key ] = array_values( array_map( array( $this, 'get_order_item_data' ), $data[ $key ] ) );
156
+			$data[$key] = array_values( array_map( array( $this, 'get_order_item_data' ), $data[$key] ) );
157 157
 		}
158 158
 
159 159
 		return array(
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 				$line_tax = array();
295 295
 
296 296
 				foreach ( $item_line_taxes['total'] as $tax_rate_id => $tax ) {
297
-					$line_tax[ $tax_rate_id ] = array(
297
+					$line_tax[$tax_rate_id] = array(
298 298
 						'id'       => $tax_rate_id,
299 299
 						'total'    => $tax,
300 300
 						'subtotal' => '',
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
 				}
303 303
 
304 304
 				foreach ( $item_line_taxes['subtotal'] as $tax_rate_id => $tax ) {
305
-					$line_tax[ $tax_rate_id ]['subtotal'] = $tax;
305
+					$line_tax[$tax_rate_id]['subtotal'] = $tax;
306 306
 				}
307 307
 
308 308
 				$line_item['taxes'] = array_values( $line_tax );
Please login to merge, or discard this patch.
src/Controllers/Version4/SystemStatus.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -69,12 +69,12 @@  discard block
 block discarded – undo
69 69
 
70 70
 		foreach ( $mappings as $section => $values ) {
71 71
 			foreach ( $values as $key => $value ) {
72
-				if ( isset( $schema['properties'][ $section ]['properties'][ $key ]['type'] ) ) {
73
-					settype( $values[ $key ], $schema['properties'][ $section ]['properties'][ $key ]['type'] );
72
+				if ( isset( $schema['properties'][$section]['properties'][$key]['type'] ) ) {
73
+					settype( $values[$key], $schema['properties'][$section]['properties'][$key]['type'] );
74 74
 				}
75 75
 			}
76
-			settype( $values, $schema['properties'][ $section ]['type'] );
77
-			$response[ $section ] = $values;
76
+			settype( $values, $schema['properties'][$section]['type'] );
77
+			$response[$section] = $values;
78 78
 		}
79 79
 
80 80
 		$response = $this->prepare_item_for_response( $response, $request );
@@ -764,7 +764,7 @@  discard block
 block discarded – undo
764 764
 			}
765 765
 			$table_type = in_array( $table->name, $core_tables, true ) ? 'woocommerce' : 'other';
766 766
 
767
-			$tables[ $table_type ][ $table->name ] = array(
767
+			$tables[$table_type][$table->name] = array(
768 768
 				'data'   => $table->data,
769 769
 				'index'  => $table->index,
770 770
 				'engine' => $table->engine,
@@ -880,8 +880,8 @@  discard block
 block discarded – undo
880 880
 		$version_latest = $data['Version'];
881 881
 
882 882
 		// Find latest version.
883
-		if ( isset( $this->available_updates[ $plugin ]->update->new_version ) ) {
884
-			$version_latest = $this->available_updates[ $plugin ]->update->new_version;
883
+		if ( isset( $this->available_updates[$plugin]->update->new_version ) ) {
884
+			$version_latest = $this->available_updates[$plugin]->update->new_version;
885 885
 		}
886 886
 
887 887
 		return array(
@@ -1023,14 +1023,14 @@  discard block
 block discarded – undo
1023 1023
 		$term_response = array();
1024 1024
 		$terms         = get_terms( 'product_type', array( 'hide_empty' => 0 ) );
1025 1025
 		foreach ( $terms as $term ) {
1026
-			$term_response[ $term->slug ] = strtolower( $term->name );
1026
+			$term_response[$term->slug] = strtolower( $term->name );
1027 1027
 		}
1028 1028
 
1029 1029
 		// Get a list of terms used for product visibility.
1030 1030
 		$product_visibility_terms = array();
1031 1031
 		$terms                    = get_terms( 'product_visibility', array( 'hide_empty' => 0 ) );
1032 1032
 		foreach ( $terms as $term ) {
1033
-			$product_visibility_terms[ $term->slug ] = strtolower( $term->name );
1033
+			$product_visibility_terms[$term->slug] = strtolower( $term->name );
1034 1034
 		}
1035 1035
 
1036 1036
 		// Check if WooCommerce.com account is connected.
Please login to merge, or discard this patch.
src/Controllers/Version4/Coupons.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -148,19 +148,19 @@  discard block
 block discarded – undo
148 148
 
149 149
 		// Format decimal values.
150 150
 		foreach ( $format_decimal as $key ) {
151
-			$data[ $key ] = wc_format_decimal( $data[ $key ], 2 );
151
+			$data[$key] = wc_format_decimal( $data[$key], 2 );
152 152
 		}
153 153
 
154 154
 		// Format date values.
155 155
 		foreach ( $format_date as $key ) {
156
-			$datetime              = $data[ $key ];
157
-			$data[ $key ]          = wc_rest_prepare_date_response( $datetime, false );
158
-			$data[ $key . '_gmt' ] = wc_rest_prepare_date_response( $datetime );
156
+			$datetime              = $data[$key];
157
+			$data[$key]          = wc_rest_prepare_date_response( $datetime, false );
158
+			$data[$key . '_gmt'] = wc_rest_prepare_date_response( $datetime );
159 159
 		}
160 160
 
161 161
 		// Format null values.
162 162
 		foreach ( $format_null as $key ) {
163
-			$data[ $key ] = $data[ $key ] ? $data[ $key ] : null;
163
+			$data[$key] = $data[$key] ? $data[$key] : null;
164 164
 		}
165 165
 
166 166
 		return array(
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
 
267 267
 		// Handle all writable props.
268 268
 		foreach ( $data_keys as $key ) {
269
-			$value = $request[ $key ];
269
+			$value = $request[$key];
270 270
 
271 271
 			if ( ! is_null( $value ) ) {
272 272
 				switch ( $key ) {
Please login to merge, or discard this patch.
src/Controllers/Version4/TaxClasses.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -232,7 +232,7 @@
 block discarded – undo
232 232
 		foreach ( $classes as $key => $class ) {
233 233
 			if ( sanitize_title( $class ) === $tax_class['slug'] ) {
234 234
 				$tax_class['name'] = $class;
235
-				unset( $classes[ $key ] );
235
+				unset( $classes[$key] );
236 236
 				$deleted = true;
237 237
 				break;
238 238
 			}
Please login to merge, or discard this patch.
src/Controllers/Version4/AbstractTermsContoller.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 		$max_pages = ceil( $total_terms / $per_page );
354 354
 		$response->header( 'X-WP-TotalPages', (int) $max_pages );
355 355
 
356
-		$base  = str_replace( '(?P<attribute_id>[\d]+)', $request['attribute_id'], $this->rest_base );
356
+		$base = str_replace( '(?P<attribute_id>[\d]+)', $request['attribute_id'], $this->rest_base );
357 357
 		$base = add_query_arg( $request->get_query_params(), rest_url( '/' . $this->namespace . '/' . $base ) );
358 358
 		if ( $page > 1 ) {
359 359
 			$prev_page = $page - 1;
@@ -728,7 +728,7 @@  discard block
 block discarded – undo
728 728
 				'validate_callback' => 'rest_validate_request_arg',
729 729
 			);
730 730
 		}
731
-		$params['order']      = array(
731
+		$params['order'] = array(
732 732
 			'description'       => __( 'Order sort attribute ascending or descending.', 'woocommerce' ),
733 733
 			'type'              => 'string',
734 734
 			'sanitize_callback' => 'sanitize_key',
@@ -739,7 +739,7 @@  discard block
 block discarded – undo
739 739
 			),
740 740
 			'validate_callback' => 'rest_validate_request_arg',
741 741
 		);
742
-		$params['orderby']    = array(
742
+		$params['orderby'] = array(
743 743
 			'description'       => __( 'Sort collection by resource attribute.', 'woocommerce' ),
744 744
 			'type'              => 'string',
745 745
 			'sanitize_callback' => 'sanitize_key',
@@ -775,7 +775,7 @@  discard block
 block discarded – undo
775 775
 			'default'           => null,
776 776
 			'validate_callback' => 'rest_validate_request_arg',
777 777
 		);
778
-		$params['slug']    = array(
778
+		$params['slug'] = array(
779 779
 			'description'       => __( 'Limit result set to resources with a specific slug.', 'woocommerce' ),
780 780
 			'type'              => 'string',
781 781
 			'validate_callback' => 'rest_validate_request_arg',
Please login to merge, or discard this patch.
src/Controllers/Version4/Webhooks.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -722,13 +722,13 @@  discard block
 block discarded – undo
722 722
 
723 723
 		$params['context']['default'] = 'view';
724 724
 
725
-		$params['after']   = array(
725
+		$params['after'] = array(
726 726
 			'description'       => __( 'Limit response to resources published after a given ISO8601 compliant date.', 'woocommerce' ),
727 727
 			'type'              => 'string',
728 728
 			'format'            => 'date-time',
729 729
 			'validate_callback' => 'rest_validate_request_arg',
730 730
 		);
731
-		$params['before']  = array(
731
+		$params['before'] = array(
732 732
 			'description'       => __( 'Limit response to resources published before a given ISO8601 compliant date.', 'woocommerce' ),
733 733
 			'type'              => 'string',
734 734
 			'format'            => 'date-time',
@@ -752,13 +752,13 @@  discard block
 block discarded – undo
752 752
 			'default'           => array(),
753 753
 			'sanitize_callback' => 'wp_parse_id_list',
754 754
 		);
755
-		$params['offset']  = array(
755
+		$params['offset'] = array(
756 756
 			'description'       => __( 'Offset the result set by a specific number of items.', 'woocommerce' ),
757 757
 			'type'              => 'integer',
758 758
 			'sanitize_callback' => 'absint',
759 759
 			'validate_callback' => 'rest_validate_request_arg',
760 760
 		);
761
-		$params['order']   = array(
761
+		$params['order'] = array(
762 762
 			'description'       => __( 'Order sort attribute ascending or descending.', 'woocommerce' ),
763 763
 			'type'              => 'string',
764 764
 			'default'           => 'desc',
@@ -776,7 +776,7 @@  discard block
 block discarded – undo
776 776
 			),
777 777
 			'validate_callback' => 'rest_validate_request_arg',
778 778
 		);
779
-		$params['status']  = array(
779
+		$params['status'] = array(
780 780
 			'default'           => 'all',
781 781
 			'description'       => __( 'Limit result set to webhooks assigned a specific status.', 'woocommerce' ),
782 782
 			'type'              => 'string',
Please login to merge, or discard this patch.
src/Controllers/Version4/AbstractObjectsController.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -421,8 +421,8 @@  discard block
 block discarded – undo
421 421
 				$beginning_offset = strlen( $attrib_prefix );
422 422
 				$attrib_name_end  = strpos( $attrib_name_match[0], '>', $attrib_name_match[1] );
423 423
 				$attrib_name      = substr( $attrib_name_match[0], $beginning_offset, $attrib_name_end - $beginning_offset );
424
-				if ( isset( $request[ $attrib_name ] ) ) {
425
-					$base = str_replace( "(?P<$attrib_name>[\d]+)", $request[ $attrib_name ], $base );
424
+				if ( isset( $request[$attrib_name] ) ) {
425
+					$base = str_replace( "(?P<$attrib_name>[\d]+)", $request[$attrib_name], $base );
426 426
 				}
427 427
 			}
428 428
 		}
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
 		$valid_vars = array_flip( $this->get_allowed_query_vars() );
727 727
 		$query_args = array();
728 728
 		foreach ( $valid_vars as $var => $index ) {
729
-			if ( isset( $prepared_args[ $var ] ) ) {
729
+			if ( isset( $prepared_args[$var] ) ) {
730 730
 				/**
731 731
 				 * Filter the query_vars used in `get_items` for the constructed query.
732 732
 				 *
@@ -734,7 +734,7 @@  discard block
 block discarded – undo
734 734
 				 *
735 735
 				 * @param mixed $prepared_args[ $var ] The query_var value.
736 736
 				 */
737
-				$query_args[ $var ] = apply_filters( "woocommerce_rest_query_var_{$var}", $prepared_args[ $var ] );
737
+				$query_args[$var] = apply_filters( "woocommerce_rest_query_var_{$var}", $prepared_args[$var] );
738 738
 			}
739 739
 		}
740 740
 
Please login to merge, or discard this patch.
src/Controllers/Version4/Customers.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -240,9 +240,9 @@  discard block
 block discarded – undo
240 240
 		// Format date values.
241 241
 		foreach ( $format_date as $key ) {
242 242
 			// Date created is stored UTC, date modified is stored WP local time.
243
-			$datetime              = 'date_created' === $key ? get_date_from_gmt( gmdate( 'Y-m-d H:i:s', $data[ $key ]->getTimestamp() ) ) : $data[ $key ];
244
-			$data[ $key ]          = wc_rest_prepare_date_response( $datetime, false );
245
-			$data[ $key . '_gmt' ] = wc_rest_prepare_date_response( $datetime );
243
+			$datetime              = 'date_created' === $key ? get_date_from_gmt( gmdate( 'Y-m-d H:i:s', $data[$key]->getTimestamp() ) ) : $data[$key];
244
+			$data[$key]          = wc_rest_prepare_date_response( $datetime, false );
245
+			$data[$key . '_gmt'] = wc_rest_prepare_date_response( $datetime );
246 246
 		}
247 247
 
248 248
 		return array(
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 			'name'            => 'display_name',
288 288
 			'registered_date' => 'registered',
289 289
 		);
290
-		$prepared_args['orderby'] = $orderby_possibles[ $request['orderby'] ];
290
+		$prepared_args['orderby'] = $orderby_possibles[$request['orderby']];
291 291
 		$prepared_args['search']  = $request['search'];
292 292
 
293 293
 		if ( '' !== $prepared_args['search'] ) {
@@ -604,8 +604,8 @@  discard block
 block discarded – undo
604 604
 		// Customer billing address.
605 605
 		if ( isset( $request['billing'] ) ) {
606 606
 			foreach ( array_keys( $schema['properties']['billing']['properties'] ) as $field ) {
607
-				if ( isset( $request['billing'][ $field ] ) && is_callable( array( $customer, "set_billing_{$field}" ) ) ) {
608
-					$customer->{"set_billing_{$field}"}( $request['billing'][ $field ] );
607
+				if ( isset( $request['billing'][$field] ) && is_callable( array( $customer, "set_billing_{$field}" ) ) ) {
608
+					$customer->{"set_billing_{$field}"}( $request['billing'][$field] );
609 609
 				}
610 610
 			}
611 611
 		}
@@ -613,8 +613,8 @@  discard block
 block discarded – undo
613 613
 		// Customer shipping address.
614 614
 		if ( isset( $request['shipping'] ) ) {
615 615
 			foreach ( array_keys( $schema['properties']['shipping']['properties'] ) as $field ) {
616
-				if ( isset( $request['shipping'][ $field ] ) && is_callable( array( $customer, "set_shipping_{$field}" ) ) ) {
617
-					$customer->{"set_shipping_{$field}"}( $request['shipping'][ $field ] );
616
+				if ( isset( $request['shipping'][$field] ) && is_callable( array( $customer, "set_shipping_{$field}" ) ) ) {
617
+					$customer->{"set_shipping_{$field}"}( $request['shipping'][$field] );
618 618
 				}
619 619
 			}
620 620
 		}
Please login to merge, or discard this patch.