Passed
Push — master ( f7c939...5bd17a )
by Mike
03:08
created
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.
src/Controllers/Version4/Customers.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -153,7 +153,7 @@
 block discarded – undo
153 153
 			'name'            => 'display_name',
154 154
 			'registered_date' => 'registered',
155 155
 		);
156
-		$prepared_args['orderby'] = $orderby_possibles[ $request['orderby'] ];
156
+		$prepared_args['orderby'] = $orderby_possibles[$request['orderby']];
157 157
 		$prepared_args['search']  = $request['search'];
158 158
 
159 159
 		if ( '' !== $prepared_args['search'] ) {
Please login to merge, or discard this patch.
src/Controllers/Version4/Utilities/BatchTrait.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -25,11 +25,11 @@  discard block
 block discarded – undo
25 25
 			return $limit;
26 26
 		}
27 27
 
28
-		$batches  = [ 'create', 'update', 'delete' ];
28
+		$batches  = ['create', 'update', 'delete'];
29 29
 		$response = [];
30 30
 
31 31
 		foreach ( $batches as $batch ) {
32
-			$response[ $batch ] = $this->{"batch_$batch"}( $this->get_batch_of_items_from_request( $request, $batch ) );
32
+			$response[$batch] = $this->{"batch_$batch"}( $this->get_batch_of_items_from_request( $request, $batch ) );
33 33
 		}
34 34
 
35 35
 		return array_filter( $response );
@@ -45,11 +45,11 @@  discard block
 block discarded – undo
45 45
 	protected function get_batch_of_items_from_request( $request, $batch_type ) {
46 46
 		$params = $request->get_params();
47 47
 
48
-		if ( ! isset( $params[ $batch_type ] ) ) {
48
+		if ( ! isset( $params[$batch_type] ) ) {
49 49
 			return array();
50 50
 		}
51 51
 
52
-		return array_filter( $params[ $batch_type ] );
52
+		return array_filter( $params[$batch_type] );
53 53
 	}
54 54
 
55 55
 	/**
@@ -141,13 +141,13 @@  discard block
 block discarded – undo
141 141
 	protected function check_batch_limit( $items ) {
142 142
 		$limit   = apply_filters( 'woocommerce_rest_batch_items_limit', 100, $this->get_normalized_rest_base() );
143 143
 		$total   = 0;
144
-		$batches = [ 'create', 'update', 'delete' ];
144
+		$batches = ['create', 'update', 'delete'];
145 145
 
146 146
 		foreach ( $batches as $batch ) {
147
-			if ( ! isset( $items[ $batch ] ) ) {
147
+			if ( ! isset( $items[$batch] ) ) {
148 148
 				continue;
149 149
 			}
150
-			$total = $total + count( $items[ $batch ] );
150
+			$total = $total + count( $items[$batch] );
151 151
 		}
152 152
 
153 153
 		if ( $total > $limit ) {
@@ -168,7 +168,7 @@  discard block
 block discarded – undo
168 168
 		$schema   = $this->get_public_item_schema();
169 169
 		foreach ( $schema['properties'] as $arg => $options ) {
170 170
 			if ( isset( $options['default'] ) ) {
171
-				$defaults[ $arg ] = $options['default'];
171
+				$defaults[$arg] = $options['default'];
172 172
 			}
173 173
 		}
174 174
 		return $defaults;
Please login to merge, or discard this patch.
src/Controllers/Version4/Utilities/Permissions.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -47,11 +47,11 @@  discard block
 block discarded – undo
47 47
 	 * @return boolean
48 48
 	 */
49 49
 	public static function check_resource( $resource, $context = 'read', $resource_id = 0 ) {
50
-		if ( ! isset( self::$resource_permissions[ $resource ] ) ) {
50
+		if ( ! isset( self::$resource_permissions[$resource] ) ) {
51 51
 			return false;
52 52
 		}
53
-		$permissions = self::$resource_permissions[ $resource ];
54
-		$capability  = is_array( $permissions ) ? $permissions[ $context ] : $permissions;
53
+		$permissions = self::$resource_permissions[$resource];
54
+		$capability  = is_array( $permissions ) ? $permissions[$context] : $permissions;
55 55
 		$permission  = current_user_can( $capability );
56 56
 
57 57
 		return apply_filters( 'woocommerce_rest_check_permissions', $permission, $context, $resource_id, $resource );
@@ -66,14 +66,14 @@  discard block
 block discarded – undo
66 66
 	 * @return boolean
67 67
 	 */
68 68
 	public static function check_taxonomy( $taxonomy, $context = 'read', $object_id = 0 ) {
69
-		$contexts        = array(
69
+		$contexts = array(
70 70
 			'read'   => 'manage_terms',
71 71
 			'create' => 'edit_terms',
72 72
 			'edit'   => 'edit_terms',
73 73
 			'delete' => 'delete_terms',
74 74
 			'batch'  => 'edit_terms',
75 75
 		);
76
-		$cap             = $contexts[ $context ];
76
+		$cap             = $contexts[$context];
77 77
 		$taxonomy_object = get_taxonomy( $taxonomy );
78 78
 		$permission      = current_user_can( $taxonomy_object->cap->$cap, $object_id );
79 79
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 		if ( 'revision' === $post_type ) {
101 101
 			$permission = false;
102 102
 		} else {
103
-			$cap              = $contexts[ $context ];
103
+			$cap              = $contexts[$context];
104 104
 			$post_type_object = get_post_type_object( $post_type );
105 105
 			$permission       = current_user_can( $post_type_object->cap->$cap, $object_id );
106 106
 		}
Please login to merge, or discard this patch.