Passed
Push — master ( bd3828...767719 )
by Mike
06:57 queued 18s
created
src/Controllers/Version4/Requests/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/Responses/ProductResponse.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -308,10 +308,10 @@
 block discarded – undo
308 308
 		$attribute  = false;
309 309
 
310 310
 		// pa_ attributes.
311
-		if ( isset( $attributes[ wc_attribute_taxonomy_name( $slug ) ] ) ) {
312
-			$attribute = $attributes[ wc_attribute_taxonomy_name( $slug ) ];
313
-		} elseif ( isset( $attributes[ $slug ] ) ) {
314
-			$attribute = $attributes[ $slug ];
311
+		if ( isset( $attributes[wc_attribute_taxonomy_name( $slug )] ) ) {
312
+			$attribute = $attributes[wc_attribute_taxonomy_name( $slug )];
313
+		} elseif ( isset( $attributes[$slug] ) ) {
314
+			$attribute = $attributes[$slug];
315 315
 		}
316 316
 
317 317
 		if ( ! $attribute ) {
Please login to merge, or discard this patch.
src/Controllers/Version4/Responses/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.
src/Controllers/Version4/SystemStatus.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@
 block discarded – undo
68 68
 		$response = array();
69 69
 
70 70
 		foreach ( $mappings as $section => $values ) {
71
-			$response[ $section ] = $values;
71
+			$response[$section] = $values;
72 72
 		}
73 73
 
74 74
 		$response = $this->prepare_item_for_response( $response, $request );
Please login to merge, or discard this patch.
src/Utilities/PluginInformation.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	 * @return array
37 37
 	 */
38 38
 	public function get_active_plugin_data() {
39
-		return array_map( [ $this, 'format_plugin_data' ], array_map( [ $this, 'get_plugin_data' ], $this->get_active_plugins() ) );
39
+		return array_map( [$this, 'format_plugin_data'], array_map( [$this, 'get_plugin_data'], $this->get_active_plugins() ) );
40 40
 	}
41 41
 
42 42
 	/**
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 	 * @return array
46 46
 	 */
47 47
 	public function get_inactive_plugin_data() {
48
-		return array_map( [ $this, 'format_plugin_data' ], array_map( [ $this, 'get_plugin_data' ], $this->get_inactive_plugins() ) );
48
+		return array_map( [$this, 'format_plugin_data'], array_map( [$this, 'get_plugin_data'], $this->get_inactive_plugins() ) );
49 49
 	}
50 50
 
51 51
 	/**
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	 * @return array
56 56
 	 */
57 57
 	public function get_dropin_and_mu_plugin_data() {
58
-		$plugins               = [
58
+		$plugins = [
59 59
 			'dropins'    => [],
60 60
 			'mu_plugins' => [],
61 61
 		];
@@ -131,8 +131,8 @@  discard block
 block discarded – undo
131 131
 		$version_latest = $data['Version'];
132 132
 
133 133
 		// Find latest version.
134
-		if ( isset( $this->available_updates[ $data['plugin_file'] ]->update->new_version ) ) {
135
-			$version_latest = $this->available_updates[ $data['plugin_file'] ]->update->new_version;
134
+		if ( isset( $this->available_updates[$data['plugin_file']]->update->new_version ) ) {
135
+			$version_latest = $this->available_updates[$data['plugin_file']]->update->new_version;
136 136
 		}
137 137
 
138 138
 		return array(
Please login to merge, or discard this patch.
src/Utilities/WooEnvironment.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,14 +23,14 @@
 block discarded – undo
23 23
 		$term_response = array();
24 24
 		$terms         = get_terms( 'product_type', array( 'hide_empty' => 0 ) );
25 25
 		foreach ( $terms as $term ) {
26
-			$term_response[ $term->slug ] = strtolower( $term->name );
26
+			$term_response[$term->slug] = strtolower( $term->name );
27 27
 		}
28 28
 
29 29
 		// Get a list of terms used for product visibility.
30 30
 		$product_visibility_terms = array();
31 31
 		$terms                    = get_terms( 'product_visibility', array( 'hide_empty' => 0 ) );
32 32
 		foreach ( $terms as $term ) {
33
-			$product_visibility_terms[ $term->slug ] = strtolower( $term->name );
33
+			$product_visibility_terms[$term->slug] = strtolower( $term->name );
34 34
 		}
35 35
 
36 36
 		// Check if WooCommerce.com account is connected.
Please login to merge, or discard this patch.
src/Utilities/DatabaseInformation.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@
 block discarded – undo
96 96
 			}
97 97
 			$table_type = in_array( $table->name, $core_tables, true ) ? 'woocommerce' : 'other';
98 98
 
99
-			$tables[ $table_type ][ $table->name ] = array(
99
+			$tables[$table_type][$table->name] = array(
100 100
 				'data'   => $table->data,
101 101
 				'index'  => $table->index,
102 102
 				'engine' => $table->engine,
Please login to merge, or discard this patch.
src/Controllers/Version4/Requests/CustomerRequest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -62,13 +62,13 @@  discard block
 block discarded – undo
62 62
 					if ( email_exists( $value ) && $value !== $object->get_email() ) {
63 63
 						throw new \WC_REST_Exception( 'woocommerce_rest_customer_invalid_email', __( 'Email address is invalid.', 'woocommerce' ), 400 );
64 64
 					}
65
-					$prop_values[ $prop ] = $value;
65
+					$prop_values[$prop] = $value;
66 66
 					break;
67 67
 				case 'username':
68 68
 					if ( $object->get_id() && $value !== $object->get_username() ) {
69 69
 						throw new \WC_REST_Exception( 'woocommerce_rest_customer_invalid_argument', __( "Username isn't editable.", 'woocommerce' ), 400 );
70 70
 					}
71
-					$prop_values[ $prop ] = $value;
71
+					$prop_values[$prop] = $value;
72 72
 					break;
73 73
 				case 'billing':
74 74
 				case 'shipping':
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 					$prop_values = array_merge( $prop_values, $address );
77 77
 					break;
78 78
 				default:
79
-					$prop_values[ $prop ] = $value;
79
+					$prop_values[$prop] = $value;
80 80
 			}
81 81
 		}
82 82
 
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 		$address = [];
98 98
 		foreach ( $data as $key => $value ) {
99 99
 			if ( is_callable( array( $object, "set_{$type}_{$key}" ) ) ) {
100
-				$address[ "{$type}_{$key}" ] = $value;
100
+				$address["{$type}_{$key}"] = $value;
101 101
 			}
102 102
 		}
103 103
 		return $address;
Please login to merge, or discard this patch.
src/Controllers/Version4/Responses/CustomerResponse.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -28,9 +28,9 @@
 block discarded – undo
28 28
 		// Format date values.
29 29
 		foreach ( $format_date as $key ) {
30 30
 			// Date created is stored UTC, date modified is stored WP local time.
31
-			$datetime              = 'date_created' === $key ? get_date_from_gmt( gmdate( 'Y-m-d H:i:s', $data[ $key ]->getTimestamp() ) ) : $data[ $key ];
32
-			$data[ $key ]          = wc_rest_prepare_date_response( $datetime, false );
33
-			$data[ $key . '_gmt' ] = wc_rest_prepare_date_response( $datetime );
31
+			$datetime              = 'date_created' === $key ? get_date_from_gmt( gmdate( 'Y-m-d H:i:s', $data[$key]->getTimestamp() ) ) : $data[$key];
32
+			$data[$key]          = wc_rest_prepare_date_response( $datetime, false );
33
+			$data[$key . '_gmt'] = wc_rest_prepare_date_response( $datetime );
34 34
 		}
35 35
 
36 36
 		return array(
Please login to merge, or discard this patch.