Code Duplication    Length = 11-11 lines in 2 locations

includes/cli/class-wc-cli-product.php 1 location

@@ 1187-1197 (lines=11) @@
1184
						wp_set_object_terms( $product_id, $values, $taxonomy );
1185
					}
1186
1187
					if ( ! empty( $values ) ) {
1188
						// Add attribute to array, but don't set values
1189
						$attributes[ $taxonomy ] = array(
1190
							'name'         => $taxonomy,
1191
							'value'        => '',
1192
							'position'     => isset( $attribute['position'] ) ? absint( $attribute['position'] ) : 0,
1193
							'is_visible'   => ( isset( $attribute['visible'] ) && $attribute['visible'] ) ? 1 : 0,
1194
							'is_variation' => ( isset( $attribute['variation'] ) && $attribute['variation'] ) ? 1 : 0,
1195
							'is_taxonomy'  => $is_taxonomy
1196
						);
1197
					}
1198
1199
				} elseif ( isset( $attribute['options'] ) ) {
1200
					// Array based

includes/api/class-wc-rest-products-controller.php 1 location

@@ 1010-1020 (lines=11) @@
1007
						wp_set_object_terms( $product->id, $values, $attribute_name );
1008
					}
1009
1010
					if ( ! empty( $values ) ) {
1011
						// Add attribute to array, but don't set values.
1012
						$attributes[ $attribute_name ] = array(
1013
							'name'         => $attribute_name,
1014
							'value'        => '',
1015
							'position'     => isset( $attribute['position'] ) ? (string) absint( $attribute['position'] ) : '0',
1016
							'is_visible'   => ( isset( $attribute['visible'] ) && $attribute['visible'] ) ? 1 : 0,
1017
							'is_variation' => ( isset( $attribute['variation'] ) && $attribute['variation'] ) ? 1 : 0,
1018
							'is_taxonomy'  => 1,
1019
						);
1020
					}
1021
1022
				} elseif ( isset( $attribute['options'] ) ) {
1023
					// Array based.